我有一个 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);
是最优的吗?最好的方法是什么?