Max*_*Max 3 3d core-animation render ios catransformlayer
我正在尝试将包含几个CAShapeLayers的CATransformLayer渲染到png文件中.我知道如何设置基本渲染,这确实有效.
虽然当我在CATransformLayer上调用renderInContext时,它会将所有内容展平为2D并完全忽略我的变换矩阵(旋转和/或透视).
如何将我的3d CATransformLayer及其所有CAShapeLayers呈现为PNG/UIImage?
由于你的目标只是iOS7及以上,我建议你放弃renderInContext:并替换它-[UIView drawViewHierarchyInRect:afterScreenUpdates:].您的代码可能看起来像这样:
UIGraphicsBeginImageContext(sizeOfYourImage);
[yourViewToRender drawViewHierarchyInRect:(CGRect){0, 0, sizeOfYourImage} afterScreenUpdates:YES];
UIImage *renderedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
207 次 |
| 最近记录: |