6

我用

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

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

我怎样才能从 CALayer 得到这个效果图?

4

1 回答 1

2

我的原始回复如下。它在我发布时有效,但 Apple 不再允许使用 UIGetScreenImage。据我所知,在 iOS4 发布后,没有其他选择如何使用 3D 转换渲染图层 + 如果您使用 UIGetScreenImage,您的应用程序将被拒绝



来自 renderInContext 上的 iPhone 开发人员文档:

此外,不会渲染使用 3D 变换的图层,也不会渲染指定 backgroundFilters、filters、compositingFilter 或掩码值的图层。

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

你能做的最好的就是调用:UIGetScreenImage,它基本上会给你一个截图,然后你可以从这个截图中提取图像。

于 2010-02-28T21:28:42.877 回答