Re: Compositing math in SVG

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 UTC