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

Re: Compositing math in SVG

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 25 Jul 2012 21:09:25 -0700
To: Rik Cabanier <cabanier@gmail.com>
CC: Calculemus <calculemus1988@gmail.com>, "steve@fenestra.com" <steve@fenestra.com>, "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <B461D791-2B07-45B5-BBE0-2E7EEC6A2E11@adobe.com>
Since blend mode with source over should match what feBlend is doing, did you try your images on SVG Filters? Do you see the same issue there?

Greetings,
Dirk

On Jul 25, 2012, at 8:59 PM, Rik Cabanier wrote:

> That looks correct.
> Try to debug your code with solid color bitmaps (the top one should be 75% alpha) and see if your output matches the formulas and photoshop's/gimp's rendering.
> 
> Rik
> 
> On Wed, Jul 25, 2012 at 5:59 PM, Calculemus <calculemus1988@gmail.com> wrote:
> Hmm, actually I do take care of that.
> 
> These are the formulas I use:
> 
> Notation:
> 
> 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, b/alpha_b)
> 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 there.
> 
> 
> 
Received on Thursday, 26 July 2012 04:09:56 GMT

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