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

Re: Compositing math in SVG

From: Rik Cabanier <cabanier@gmail.com>
Date: Fri, 27 Jul 2012 15:59:01 -0700
Message-ID: <CAGN7qDD099XYmxw+spESRH3BKwMTLPNLO5Wke2qDLkdDxHS21Q@mail.gmail.com>
To: Calculemus <calculemus1988@gmail.com>
Cc: Dirk Schulze <dschulze@adobe.com>, "steve@fenestra.com" <steve@fenestra.com>, "www-svg@w3.org" <www-svg@w3.org>
Where is the alpha coming from? Is it already in the image that you're
applying blending to?
It so, you need to alpha blend with the background first and then blend.

There's a different between:

<img>
<g alpha=.75 blend=multiply>

<img>

</g>

and

<img>
<g blend=multiply>

<img alpha=.75 >

</g>



Rik

On Fri, Jul 27, 2012 at 3:33 PM, Calculemus <calculemus1988@gmail.com>wrote:

> 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:59:30 GMT

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