- From: Rik Cabanier <cabanier@gmail.com>
- Date: Sun, 15 Jul 2012 18:30:44 -0700
- To: Calculemus <calculemus1988@gmail.com>
- Cc: www-svg@w3.org
Received on Monday, 16 July 2012 01:31:12 UTC
On Sat, Jul 14, 2012 at 12:23 AM, Calculemus <calculemus1988@gmail.com>wrote: > 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. > No, you need to clamp after blending. In the case of colordodge, what happens if Cs is 1 and you divide by zero? If you get infinity and the min(1, infinity) returns 1, you're set. (This is not clamping) > > Are there completely reduced versions of the combinations of blend modes > with over somewhere? > > The existing SVG spec should have them but they might not be in an obvious notation.
Received on Monday, 16 July 2012 01:31:12 UTC