[算法]两个RGB颜色的半透明混色
from: http://blog.csdn.net/cuixiping/article/details/1698835
32位色下的颜色混合。
R1、G1、B1、Alpha1指上层的颜色值
R2、G2、B2、Alpha2指下层的颜色值
R、G、B、Alpha指合并后的颜色
具体算式见下:
Alpha = 1 - (1 - Alpha1) * (1 - Alpha2)
R = (R1 * Alpha1 + R2 * Alpha2 * (1 - Alpha1)) / Alpha
G = (G1 * Alpha1 + G2 * Alpha2 * (1 - Alpha1)) / Alpha
B = (B1 * Alpha1 + B2 * Alpha2 * (1-Alpha1)) / Alpha