views:

684

answers:

1

I use

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

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

How can I get this effect image from CALayer?

+1  A: 

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



From the iPhone developer docs on renderInContext :

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

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

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.

Ican Zilb
UIGetScreenImage is not allowed anymore. I've just got an email from Apple asking to stop using this private function and use -renderInContext: (on iOs 3.x) or AV Foundation AVCaptureSession and related classes (on iOS 4).
vfn
I received today the same email from Apple and my case is similar to yours. Apparently we will have to kiss goodbye to all users using iOS3 or kiss goodbye to the capture... any thoughts?
Digital Robot
Funny enough today one of my apps got rejected too for using UIGetScreenImage()... I tested on iOS4 but renderInContext STILL DOES NOT render 3D transformations, so .. I honestly don't know what's the best thing to do right now
Ican Zilb