CALayer renderInContext [英] CALayer renderInContext

查看:49
本文介绍了CALayer renderInContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0 / -500;

成功,但是我使用 renderInContext:context从上下文中获取了CGImage,我发现了图像效果不变!

It's success, but I use "renderInContext:context" get CGImage from context, I found the image effect is not changed !

如何从CALayer获取此效果图像?

How can I get this effect image from CALayer?

推荐答案

下面是我的原始答复。它在我发布时是有效的,但是Apple不再允许使用UIGetScreenImage。就我所知,在iOS4发布之后,没有其他方法可以使用3D变换渲染图层,如果您使用UIGetScreenImage,您的应用将被拒绝

My Original reply follows bellow. It was valid at the time I posted it, but Apple does not allow the usage of UIGetScreenImage anymore. To the best of my knowledge after the launch of iOS4 there's no alternative how to render layers with 3D transformations + your app will be rejected if you use UIGetScreenImage

从iPhone开发者文档上renderInContext中:

From the iPhone developer docs on renderInContext :


使用3D
变换的图层不会渲染,指定backgroundFilters,
滤镜,compositingFilter或蒙版
值的
图层也不会渲染。

Additionally, layers that use 3D transforms are not rendered, nor are layers that specify backgroundFilters, filters, compositingFilter, or a mask values.

因此renderInContext不是您需要用来渲染已应用3D转换的图层的函数。

So renderInContext is not the function you need to use to render a layer that has a 3D transformation applied.

最好的办法是致电: UIGetScreenImage ,这基本上会给您一个屏幕截图,然后您可以从该屏幕截图中提取图像。

Best you can do is call : UIGetScreenImage, which basically will give you a screenshot and you can then extract the image out of this screenshot.

这篇关于CALayer renderInContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆