3

我有一个 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);

是最优的吗?最好的方法是什么?

4

1 回答 1

2

另一种方法似乎是创建一个子图像,我只能想象它不是最理想的。

于 2010-11-04T12:28:15.900 回答