使用 Alpha 混合模式 kBlendModeOverlay 将三个图像混合到图形上下文中
kCGBlendModeOverlay 的工作方式与 Photoshop 的叠加混合模式不完全相同吗?我试图通过以下方式将三个图像叠加到图形上下文中:
[uiimageGreen drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
[uiimageRed drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
[uiimageBlue drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
最后,如果我仅叠加三个图像中的两个,则结果在两个图像相交的地方更接近我所需的输出颜色。但是,添加第三个图像会导致第一个绘制的图像的颜色在最终的颜色混合中占主导地位。 (例如,在上面的代码中,绿色占主导地位,而结果实际上应该是白色)
如果您尝试,您会得到相同的结果吗?
Does kCGBlendModeOverlay not work exactly like Photoshop's Overlay blending mode? I'm trying to overlay three images into a graphic context via:
[uiimageGreen drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
[uiimageRed drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
[uiimageBlue drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0];
In the end, if I overlay just two of the three, the result is much closer to my desired output color in places where both images intersect. Adding the third image, however, causes the first-drawn image's color to be dominant in the resulting mix of colors. (e.g. in the above code, green comes out dominant, when the result should actually be white)
Do you get the same result if you try?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我在这里无法访问 Photoshop,所以我无法仔细检查,但事实证明我想要 kCGBlendModeScreen ...并且它可以按预期工作。这是我有缺陷的记忆,显然不能按预期工作。
一切又好起来了。 :)
Well, I didn't have Photoshop accessible here, so I couldn't double check, but it turns out I wanted kCGBlendModeScreen ...and that works as desired. It's my flawed memory that apparently doesn't work as desired.
All is well again. :)