CALayer renderInContext

浪尽此生 提交于 2019-12-19 18:57:27

问题


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:


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.



来源:https://stackoverflow.com/questions/1740953/calayer-renderincontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!