Re: Compositing math in SVG

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 UTC