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

Re: Compositing math in SVG

From: Calculemus <calculemus1988@gmail.com>
Date: Sat, 14 Jul 2012 09:23:37 +0200
Message-ID: <CAOn8Oo-WPV4kH5ay9yj5bpWVusaCyPsT49cEN+2LibjSm5zbVw@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: www-svg@w3.org
I am optimizing the blend modes and over. I got stuck with color dodge.

This is the general compositing formula from SVG spec, for
over and some blend mode B:

result = alpha_a * (1-alpha_b) * Cs + alpha_a * alpha_b * B(Cb,Cs) +
alpha_b * (1-alpha_a) * Cb

and the code for color dodge is:

float colordodge (float Cb, float Cs) {
    if (b == 1) return 1;
    return min (1.0f, Cb/(1-Cs));
}

I am not sure if I can ignore the clamping part and just use Cb/(1-Cs) for
B(Cb,Cs) in the
general compositing formula, and then simplify it. And, only then clamp.

Are there completely reduced versions of the combinations of blend modes
with over somewhere?

Thanks
Received on Saturday, 14 July 2012 07:24:04 GMT

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