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

Re: Compositing math in SVG

From: Calculemus <calculemus1988@gmail.com>
Date: Thu, 26 Jul 2012 02:59:37 +0200
Message-ID: <CAOn8Oo_=R0+zyZJr4qhcwaaMTBNUSkr1goMW7rXuhgKHDx5p9w@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: steve@fenestra.com, www-svg@w3.org
Hmm, actually I do take care of that.

These are the formulas I use:


a - premultiplied color
alpha_a - alpha for a
same notation for b

color = a*(1-alpha_b) + b*(1-alpha_a) + alpha_a*alpha_b*Blend(a/alpha_a,
alpha = alpha_a + alpha_b*(1-alpha_a)

where Blend is replaced with the proper blend formula as needed.

I don't divide 'color' with 'alpha' because we use pre-multiplied values.
But I do provide Blend with non-premultiplied values, that is why I divide
Received on Thursday, 26 July 2012 01:00:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:36 UTC