本文介绍了确定通过组合两种颜色接收的RGBA颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有两种颜色定义为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.8875red = (57 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 199.2green = (40 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 194.4blue = (28 * 0.25 + 255 * 0.85 * (1 - 0.25)) / 0.8875 = 191.1关于Alpha合成的维基百科文章。See wikipedia article on alpha compositing. 这篇关于确定通过组合两种颜色接收的RGBA颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-03 23:48
查看更多