Описание тега cgcontextdrawimage
CGContextDrawImage is available in OSX and iOS which helps to draws an image into a graphics context. The issues related with drawRect or CGContextDrawImage can be tagged with this tag
CGContextDrawImage draws an image into a graphics context. It can be used by importing Apple's CoreGraphics framework.
There are some use cases (not the majority) for which the CALayer and Core Animation approach will not work. For those cases, CGContextDrawImage could spend a lot of time in decompressing or resampling the images as necessary because the images will not be cached in the layer tree.
For more information:
Example:
Draw your image into a grayscale context
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
context = CGBitmapContextCreate(nil, inputWidth, inputHeight,
8, 0, colorSpace, (CGBitmapInfo)kCGImageAlphaNone);
CGContextDrawImage(context, imageRect, [imageWithGhost CGImage]);
CGImageRef imageRef = CGBitmapContextCreateImage(context);
UIImage * finalImage = [UIImage imageWithCGImage:imageRef];
Related stackru Questions: