Quartz 2D:如何将 UIImageView 转换应用于 CGImage?
我有一个 UIImageView,用户可以通过触摸屏幕来旋转和调整大小。 我想将用户对 UIImageView 所做的相同更改应用到其中的 UIImage 。 然后我将使用 UIImage 来屏蔽另一个图像。
请您解释一下这样做的正确程序是什么?
主要问题是我无法直接将 UIImageView 的仿射变换矩阵应用于 [UIImage CGImage],因为它们使用不同的坐标系。
i have an UIImageView that the user can rotate and resize touching the screen.
I want apply the same changes the user has made on the UIImageView to the UIImage inside it.
Then i will use the UIImage for masking another image.
Please can you explain me what is the correct procedure for doing that?
The main problem is that i can't apply directly the Affine Transformation Matrix of the UIImageView to the [UIImage CGImage], because they use a different coordinate system.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须采取的步骤是:
您需要注意的是倒置坐标系事实上,旋转图像的边界矩形现在比原来的大,在创建上下文时必须考虑到这一点。
请参阅我之前的帖子:从旋转的 UIImageView 创建 UIImage
The steps you have to take are:
Things you have to watch out for are the inverted co-ordinate system and the fact that the rotated image's bounding rectangle is now larger than the it originally was and you have to take this into account when creating your context.
See my earlier post: Creating a UIImage from a rotated UIImageView