Determine RGBA colour received by combining two colours

泄露秘密 提交于 2019-11-28 00:00:58

When using Painter's algorithm most color compositing is done using Porter-Duff "Over" mode:

Resulting alpha:

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

Resulting color components:

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

See wikipedia article on alpha compositing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!