Re: Compositing math in SVG

Having problems with the formulas from SVG spec...

I tested the blend modes and my results match
perfectly Photoshop and GIMP results, but only
for regions in the image where alpha values
are either 0 or 1 for the input images.

If the top image for example has Opacity, or
alpha 0.5 then my results are darker for some reason
I can't figure out whole day.

I am using the formulas for blend modes and Over compositing
from SVG spec:

http://www.w3.org/TR/SVGCompositing/

What could possibly be the reason for this behaviour?

The general formula is:

A*aa*(1-ba) + B*ba*(1-aa) + aa*ba*Blend(A, B)

where A and B are non-premultiplied color values and aa and ba
are alpha values.

When aa and ba are both 1 my results are fine, the formula reduces
to Blend(A,B). This confirms that I have all formulas
for blend modes correct. It is the other part before
Blend(A,B) that must somehow causing this problem.

So, this is the case for all blend modes, not just for one or two.
I wonder if the formula for compositing is correct?
The blend formulas are correct  though.

Received on Saturday, 21 July 2012 20:26:30 UTC