- From: Dirk Schulze <dschulze@adobe.com>
- Date: Wed, 29 May 2013 17:33:08 -0700
- To: Rik Cabanier <cabanier@gmail.com>
- CC: "public-fx@w3.org" <public-fx@w3.org>, www-svg <www-svg@w3.org>
On May 29, 2013, at 5:05 PM, Rik Cabanier <cabanier@gmail.com> wrote: [snip] >> yes. An 'feComposite' with the backdrop will always be followed with source-over. >> >> Also, todays use of feBlend and feComposite is limited to blend and composite intermediate filter effects results with each other (due to the lack of BackgroundImage support on browsers). I think for these operations the compositing step in feBlend makes sense, even so you still have the compositing of the filter result to the canvas. >> >> That's true. >> >> I do not understand how a new filter primitive can solve this problem if you still have the compositing step at the end. Can you elaborate more on your suggestion? >> >> My issue is that the formulas for feBlend always composite, so we need formulas that don't do this. >> >> These formulas don't composite and are in non premultiplied alpha: >> Normal: Cr = Cs >> Multiply: Cr = (1 - áb) x Cs + áb x B(Cb, Cs) = (1 - áb) x Cs + áb x Cb x Cs >> Screen: Cr = (1 - áb) x Cs + áb x B(Cb, Cs) = (1 - áb) x Cs + áb x (Cb + Cs - (Cb x Cs)) = Cs + áb x (Cb - (Cb x Cs)) >> Darken: Cr = (1 - áb) x Cs + áb x B(Cb, Cs) = (1 - áb) x Cs + áb x min(Cb, Cs) >> Lighten: Cr = (1 - áb) x Cs + áb x B(Cb, Cs) = (1 - áb) x Cs + áb x max(Cb, Cs) >> >> For premultiplied alpha, they become: >> Normal: cr = cs >> Multiply: cr = (1 - áb) x cs + cb x cs >> Screen: cr = (1 - áb) x cs + ás x áb x (Cb + Cs - (Cb x Cs)) = cs + ás x cb - cb x cs >> Darken: cr = (1 - áb) x cs + ás x áb x min(Cb, Cs) = (1 - áb) x cs + min(ás x cb, áb x cs) >> Lighten: cr = (1 - áb) x cs + ás x áb x B(Cb, Cs) = (1 - áb) x cs + max(ás x cb, áb x cs) >> Mu >> These formulas either replace the ones for feBlend, or become the ones for a new filter primitive. > > If we replace the formulas with the one without compositing, what would it mean for blending two intermediate results? > The result would exclude compositing completely. It is unclear how this can be done. > > You'd have to explicitly call feComposite on the blended result. feComposite uses the alpha channel of the two input primitives. feBlend the same, just that you loose the alpha channel on the result of your feBlend (since the state is unclear). If the next primitive after feBlend is feGaussianBlur, what would be blurred on the alpha channel? I do not think that you can easily separate blending from compositing inside a SVG filter tree. > > Note that feBlend and feComposite is not always the last primitive, so even for BackgroundImage there are problems on the next filter primitive in the chain. > > If you want to a blend and then a blur, you don't want to composite. (Michael posted another example of the backdrop becoming blurred) > I'm unsure what you mean with "there are problems on the next filter primitive in the chain." See question above. Greetings, Dirk
Received on Thursday, 30 May 2013 00:34:21 UTC