我发布了question和我还没有找到解决方案。
我想知道是否有一种方法可以使用UIImage删除另一个UIImage的一部分

我会用一个UIImage来“掩蔽”这个丑陋的黑色背景,让它变成透明的颜色。
也许使用CGContextAddPath,但我不知道如何使用它。
致以敬意,
KL94
发布于 2012-03-21 13:51:21
简单解决方案
- (UIImage*)eraseImage:(UIImage*)img1 WithImage:(UIImage*)img2
{
UIGraphicsBeginImageContext(img1.size);
[img1 drawInRect:CGRectMake(0, 0, img1.size.width, img1.size.height)];
[img2 drawInRect:CGRectMake(0, 0, img2.size.width, img2.size.height) blendMode:kCGBlendModeDestinationIn alpha:1.0];
UIImage* result_img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result_img;
}但你最好将图像保存为透明的。(像PNG)
https://stackoverflow.com/questions/4558749
复制相似问题