Re: [filter-effects] A piecewise filter

On Tue, Mar 25, 2014 at 12:52 AM, Paul LeBeau <> wrote:

> Hi
> I was trying to help someone produce an equivalent of the "Overlay"
> blending mode in Photoshop using SVG filters.  However, once I saw the
> formula for it, it became obvious that it isn't really possible to
> reproduce because of its piecewise nature.
> I also notice that "Overlay" is missing from the Compositing and Blending
> spec.  I'm curious why it was excluded considering almost all the other
> ones are represented.

"Overlay" is in the spec:

> But anyway, it made me wonder whether it would make sense to add a new
> filter type that would allow piecewise functions to be implemented.  For
> example, "Overlay" could be implemented using a definition like the
> following:
> <filter id="overlay">
>   <fePiecewise in="SourceGraphic" channelSelector="A">
>     <fePiecewiseNode min="0" max="0.5">
>        <feComposite operator="arithmetic" k1="2" k2="0" k3="0" k4="0"/>
>     </fePiecewiseNode>
>     <fePiecewiseNode min="0.5" max="1">
>        <feComposite operator="arithmetic" k1="-2" k2="2" k3="2" k4="-1"/>
>     </fePiecewiseNode>
>   </fePiecewiseNode>
> </filter>
> Thoughts?

This will have the same security issue that we faced with custom shaders:
you're giving an attacked the ability to change the rendering time based on
the value of a pixel.

Received on Tuesday, 25 March 2014 15:39:53 UTC