Re: Compositing math in SVG

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 01:00:04 UTC