使用 Alpha 混合模式 kBlendModeOverlay 将三个图像混合到图形上下文中

发布于 2024-08-15 16:14:28 字数 513 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开柳相依 2024-08-22 16:14:28

好吧,我在这里无法访问 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. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文