iphone - quartz 2D : draw from a CGContext to another CGContext

标签 iphone macos quartz-graphics quartz-2d cgcontext

我有一个 CGBitmapContext (bitmapContext),我想将它的一些矩形部分 (rect) 绘制到当前 CGContext (context) >).

现在我就是这样做的:

CGContextRef context = UIGraphicsGetCurrentContext();
CGImageRef cgImage = CGBitmapContextCreateImage(bitmapContext);
CGContextClipToRect(context, rect);
CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage);
CGImageRelease(cgImage);

这是最佳的吗?最好的方法是什么?

最佳答案

替代方案似乎是创建一个子图像,我只能想象这不太理想。

关于iphone - quartz 2D : draw from a CGContext to another CGContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3043972/

相关文章:

iphone - 如何知道正在接收当前手势的 View

swift - 实际日期加上 14 天

iphone - 在 UIView 周围创建光晕

ios - 添加页面 curl 层(不是动画)

iphone - 如何从我的 CATiledLayer 中删除这些旋转伪影?

iOS 推送通知当用户恢复安装或迁移设备时会发生什么?

iphone - 如何访问类中的ABRecordRef值?

ios - 不同屏幕的图像尺寸

assembly - 在 Mac 上编写和学习汇编

swift - 如何正确地向 NSTableView 添加一行