I have a CGBitmapContext ( bitmapContext ) and I would like to draw some rectangle part ( rect ) of it to the current CGContext ( context ).
Right now I do that way:
CGContextRef context = UIGraphicsGetCurrentContext();
CGImageRef cgImage = CGBitmapContextCreateImage(bitmapContext);
CGContextClipToRect(context, rect);
CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage);
CGImageRelease(cgImage);
Is it optimal? What is the best way to do it?
替代方案似乎是创建一个子图像,我只能想象它不是最佳的。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.