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

Re: Compositing math in SVG

From: Calculemus <calculemus1988@gmail.com>
Date: Sat, 21 Jul 2012 22:26:03 +0200
Message-ID: <CAOn8Oo_f_r+9-kWs5FOmTkJL6PVHETpPCqaSayVrKF4jXRdVhg@mail.gmail.com>
To: steve@fenestra.com
Cc: www-svg@w3.org
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 GMT

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