确定通过组合两种颜色接收的RGBA颜色

编程入门 行业动态 更新时间:2024-10-11 01:12:50
本文介绍了确定通过组合两种颜色接收的RGBA颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两种颜色定义为RGBA(在我的具体例子中,其中一个集合是[白色与alpha 0.85]和[57,40,28与alpha 0.25]。第二个颜色绘制在第一个白色与阿尔法是背景,第二种颜色是用于绘图)。我怎么知道什么是RGBA颜色的组合是什么?我需要做一次性 - 所以任何工具都很好(例如我

I have two colours defined as RGBA (in my specific examples, one of the set is [white with alpha 0.85] and [57, 40, 28 with alpha 0.25]. The second colour is drawn over the first one (i.e. white with alpha is the background and the second colour is used for drawing). How can I figure out what the RGBA colour of the combination is going to be? I need to do this one-off - so any tools is fine (e.g. I'm happy to draw something in photoshop and see what comes out).

我有几组合并,但不是太多任何指针?谢谢。

I have several sets to combine, but not too many. Any pointers? Thanks.

推荐答案

使用画家算法最常用的颜色合成是使用 Porter-Duff 过模式完成的:

结果alpha:

αr = αa + αb (1 - αa)

结果颜色组件:

Cr = (Ca αa + Cb αb (1 - αa)) / αr

您的示例:

So for your example:

alpha = 0.25 + 0.85 * (1 - 0.25) = 0.8875 red = (57 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 199.2 green = (40 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 194.4 blue = (28 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 191.1

关于Alpha合成的维基百科文章。

See wikipedia article on alpha compositing.

更多推荐

确定通过组合两种颜色接收的RGBA颜色

本文发布于:2023-11-28 21:57:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644084.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:颜色   组合   两种   RGBA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!