我有两种颜色定义为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颜色
发布评论