CGImage和CGImageRef这两个应当是用来重绘图形的类,它们在应用时是按照图像的像素矩阵来绘制图片的,它们可以用来处理bitmap。

CGImageRef与UIImage的互转


CGImageRef转换成UIImage CGImageRef

iOffscreen = CGBitmapContextCreateImage(context);

UIImage* p_w_picpath = [UIImage p_w_picpathWithCGImage: iOffscreen];


UIImage转换成CGImageRef

UIImage *loadImage=[UIImage p_w_picpathNamed:@"comicsplash.png"];

CGImageRef cgp_w_picpath=loadImage.CGImage;