RE: mixing color.... result of multiple translucent color fill?



What you need is essentially to do the alpha blend mathematically in your
code. Let's say your rectangle is sitting there with a base color C1 = {R1,
G1, B1} with aplha A1 = 1.0. You want to do paint over it with some C2 =
{R2, G2, B2} with alpha A2 < 1.0.

For each color component c1 e {R1, G1, B1} and c2 e {R2, G2, B2} of colors
C1 and C2, the corresponding component of the blended color C3 will be c3 =
c1 * ( 1 - A2 ) + c2 * ( A2 ), and its alpha will be 1.0.

I'm sorry I could only give you the math here, but it shouldn't be too
difficult to code. Additionally, note that I assumed a 0..1.0 scale for
alpha; I don't have a framework reference handy, so I can't remember how
alpha is scaled.

"Lloyd Dupont" wrote:

> I have some painting where I fill the same rect a few times with various
> translucent color.
> I would like to paint it only once with an opaque color which would be the
> mix of all my transparent colors.
>
> how do I determine the resulting color of multiple (tanslucent) color fill?
>
>
>
.