CGImageRef rectImage = CGImageCreateWithImageInRect(orignImage, CGRectMake(300, 400, 800, 400)); CGContextDrawImage 需要注意,CGContextDrawImage()方法渲染的图像是上下翻转的,可以通过调整坐标系来将图片翻转回来。 103, 214}; CGImageRef mask2 = CGImageCreateWithMaskingColors(orignImage, myMaskingColors); CGContextDrawImage 103, 214}; CGImageRef mask2 = CGImageCreateWithMaskingColors(orignImage, myMaskingColors); CGContextDrawImage nil, YES); //进行膜层的裁剪 CGContextClipToMask(contextRef, CGRectMake(0, 0, 320, 200), mask); CGContextDrawImage
effectInContext, 1.0, -1.0); CGContextTranslateCTM(effectInContext, 0, -self.size.height); CGContextDrawImage outputContext, 1.0, -1.0); CGContextTranslateCTM(outputContext, 0, -self.size.height); // 开始画底图 CGContextDrawImage ) { CGContextClipToMask(outputContext, imageRect, maskImage.CGImage); } CGContextDrawImage
将CGImage在CGContextRef上绘制出来 /* CGContextDrawImage 使用的是Core Graphics框架,坐标系与UIKit 不一样。 CGContextDrawImage 参数1:绘图上下文 参数2:rect坐标 参数3:绘制的图片 */ CGContextDrawImage(contentRef
context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage (context, CGRectMake(0, 0, w, h), img.CGImage); CGContextDrawImage(context, CGRectMake(w - logoWidth
CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast); //5、在CGContextRef上--> 将图片绘制出来 /* CGContextDrawImage CGContextDrawImage 参数1:绘图上下文 参数2:rect坐标 参数3:绘制的图片 */ CGRect rect = CGRectMake rect.size.height CGContextScaleCTM(spriteContext, 1.0, -1.0); //x,缩放1.0,y,缩放-1.0 //6.使用默认方式绘制 CGContextDrawImage
UIGraphicsBeginImageContext(size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextDrawImage
context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0); // CGContextRef context = UIGraphicsGetCurrentContext(); // CGContextDrawImage UIScreenmainScreen].scale); // // draw alpha-mask CGContextSetBlendMode(context,kCGBlendModeNormal); // CGContextDrawImage CGImageGetBitsPerComponent(imageRef),CGImageGetBytesPerRow(imageRef),colorSpaceInfo, bitmapInfo); // CGContextDrawImage context) return image; CGContextDrawImage(context,imageRect, imageRef); CGImageRef decompressedImageRef
CGContextDrawImage(ctx, CGRectMake(0,0,self.size.height,self.size.width), self.CGImage); break; default: CGContextDrawImage(ctx, CGRectMake(0,0,self.size.width,self.size.height
imageSize, YES, 0); // CGContextRef context = UIGraphicsGetCurrentContext(); // CGContextDrawImage mainScreen].scale, imageSize.height * [UIScreen mainScreen].scale); // // draw alpha-mask // CGContextDrawImage CGImageGetBitsPerComponent(imageRef),CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); // CGContextDrawImage targetWidth, targetHeight,CGImageGetBitsPerComponent(imageRef),0, colorSpaceInfo, bitmapInfo); // CGContextDrawImage
CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone); CGContextScaleCTM(bitmapRef, scale, scale); CGContextDrawImage
kCGBitmapByteOrderDefault); // Bitmap info flags 17 18 CGContextDrawImage
kCGImageAlphaOnly); CGRect rect = CGRectMake(0, 0, width, height); CGContextClearRect(context, rect); CGContextDrawImage
CGContextDrawImage(ctx, CGRectMake(0,0,self.size.height,self.size.width), self.CGImage); break; default: CGContextDrawImage(ctx, CGRectMake(0,0,self.size.width,self.size.height
colorSpace, kCGImageAlphaPremultipliedLast); CGContextDrawImage
将CGImage在CGContextRef上绘制出来 /* CGContextDrawImage 使用的是Core Graphics框架,坐标系与UIKit 不一样。 CGContextDrawImage 参数1:绘图上下文 参数2:rect坐标 参数3:绘制的图片 */ CGContextDrawImage(contentRef
CGSize){.width = OUT_WIDTH, .height = OUT_HEIGHT+LOGO_HEIGHT}, YES, properties); CGContextDrawImage CGSize){.width = OUT_WIDTH, .height = OUT_HEIGHT+LOGO_HEIGHT}, YES, properties); CGContextDrawImage
UIImage * image = [UIImage imageNamed:@"1.jpg"]; [self handleActiveRectWithFrame:_frame]; CGContextDrawImage (context,_imgFrm, image.CGImage); CGContextDrawImage(context, cirP.bounds, [[UIImage imageNamed image dw_ClipImageWithPath:cirP mode:(DWContentModeScaleAspectFill)] 有了图片了,情况基本就变成了我们熟悉的状况了,绘制图片 CGContextDrawImage
context) return NULL; CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef) 它接受一个原始的位图参数 imageRef ,最终返回一个新的解压缩后的位图 newImage ,中间主要经过了以下三个步骤: 使用 CGBitmapContextCreate 函数创建一个位图上下文; 使用 CGContextDrawImage
UIImageOrientationLeftMirrored: case UIImageOrientationRight: case UIImageOrientationRightMirrored: CGContextDrawImage aImage.size.height,aImage.size.width), aImage.CGImage); break; default: CGContextDrawImage