Quartz2D:如何绘制位图上下文并显示结果而不复制
对于任何绘画程序,您都需要能够响应用户手势来绘制线条。
有没有什么方法可以随后绘制到同一个位图并显示结果,例如,使用 UIImageView 而不用每次笔画复制位?
我尝试创建位图上下文 CGBitmapContextCreate,然后通过 CGBitmapContextCreateImage 设置 UIImageView 的图像。但不幸的是,CGBitmapContextCreateImage 也制作了一个副本。 文档中有一个提示 可以省略复制。但我还没有成功。有谁知道如何在没有复制性能负担的情况下完成此操作?
For any paint program you need to be able to draw lines in response to user gestures.
Is there any way to subsequently draw into the same bitmap and show the result, e.g., with a UIImageView without copying the bits with every stroke?
I tried to create a bitmap context CGBitmapContextCreate and then set a UIImageView's image by CGBitmapContextCreateImage. But unfortunately, CGBitmapContextCreateImage does also make a copy. There is a hint in the documentation that it might be possible to omit the copying. But I have yet failed to make it work. Does anybody know how this is done without the performance burden of copying?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论