我有一个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);
这是最优的方法吗?有没有更好的方法呢?