Re: Compositing math in SVG

Rik I am debugging as you suggested, and
I found a mismatch between the formula and
Photoshop's results.

A is top image and B is bottom image in
the attachment.
The blend mode I apply in Photoshop
is Multiply, just to keep calculations easy.

R and B components match, but for G I get
different result with the formula:
G = A*alpha_A*(1-alpha_B) + B*alpha_B*(1-alpha_A)
+ alpha_A*alpha_B*Multiply(A,B)
= 0.75*0.75*0 + 0.75*1*0.25 + 0.75*0.75*0.75=
0.609375

and that is different than 157 for G in Photoshop
which maps to 157/256=0.61328125 in range 0 to 1.

So in summary, I get same results for R and B, and for
alpha, but different for G.

Received on Friday, 27 July 2012 22:33:59 UTC