gpt4 book ai didi

objective-c - 从另一个 iOS 中减去一个图像

转载 作者:技术小花猫 更新时间:2023-10-29 11:13:34 26 4
gpt4 key购买 nike

任何人都知道如何从另一个 UIImage 中减去一个 UIImage

例如这个画面:

enter image description here

感谢回复!

最佳答案

我相信您可以使用 kCGBlendModeDestinationOut 混合模式来完成此操作。创建一个新的上下文,绘制背景图像,然后使用这种混合模式绘制前景图像。

UIGraphicsBeginImageContextWithOptions(sourceImage.size, NO, sourceImage.scale)
[sourceImage drawAtPoint:CGPointZero];
[maskImage drawAtPoint:CGPointZero blendMode:kCGBlendModeDestinationOut alpha:1.0f];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext();

关于objective-c - 从另一个 iOS 中减去一个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9690576/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com