1

嗨,我想将裁剪后的图像放在覆盖图像下(一个小图像放在背景图像上,我需要在覆盖图像下放置部分背景图像)。现在我正在使用这种方法

//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();

但我需要叠加图像下方的图像。

4

0 回答 0