基于叠加图像的UIImage裁剪

时间:2013-07-08 13:02:02

标签: ios uiimageview uiimage

您好我希望将裁剪后的图像放置在叠加图像下(在背景图像上放置一个小图像,我需要在叠加图像下部分背景图像)。现在我正在使用此方法

//create image
UIGraphicsBeginImageContextWithOptions(rect.size, YES, 1.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor blackColor] setFill];
CGContextFillRect(context, CGRectMake(0.0f, 0.0f, rect.size.width, rect.size.height));

CGContextTranslateCTM(context, rect.size.width/2.0f, rect.size.height/2.0f);
CGContextTranslateCTM(context, imageOffset.x, imageOffset.y);
CGContextRotateCTM(context, imageRotation);
CGContextTranslateCTM(context, -image.size.width/2.0f, -image.size.height/2.0f);

[image drawAtPoint:CGPointZero];

//update image
imageScale = 1.0f;
imageRotation = 0.0f;
imageOffset = CGPointZero;
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

//end context
UIGraphicsEndImageContext();

但我需要覆盖覆盖图像的图像。

0 个答案:

没有答案