W3C home > Mailing lists > Public > www-svg@w3.org > July 2012

Re: Compositing math in SVG

From: Calculemus <calculemus1988@gmail.com>
Date: Sat, 28 Jul 2012 00:33:31 +0200
Message-ID: <CAOn8Oo-Fb7QCeFs4-PFRNpbMq3pdvMf_d9n+UsgCzHOAVdBV+Q@mail.gmail.com>
To: Dirk Schulze <dschulze@adobe.com>
Cc: Rik Cabanier <cabanier@gmail.com>, "steve@fenestra.com" <steve@fenestra.com>, "www-svg@w3.org" <www-svg@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:51 GMT