CALayer renderInContext

I use

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

This is a success, but I use "renderInContext: context" to get the CGImage from the context, I found that the effect of the image does not change!

How can I get this effect image from CALayer?

+6
core-animation calayer
source share
1 answer

My original answer follows below. This was valid at the time I published it, but Apple no longer allows the use of UIGetScreenImage. As far as I know, after launching iOS4 there is no alternative how to create layers with 3D transforms + your application will be rejected if you use UIGetScreenImage



In the iPhone developer docs on renderInContext:

In addition, layers that use 3D transforms are not displayed, and layers that define backgroundFilters, filters, compositingFilter, or mask values.

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

Best of all you can call: UIGetScreenImage , which basically will give you a screenshot, and you can extract the image from this screenshot.

+2
source share

All Articles