W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2014

Re: [filter-effects] A piecewise filter

From: Dirk Schulze <dschulze@adobe.com>
Date: Tue, 25 Mar 2014 08:51:29 +0000
To: Paul LeBeau <paul.lebeau@gmail.com>
CC: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <2FAF1679-35CF-488D-9D35-EF05941DA656@adobe.com>

On Mar 25, 2014, at 8:52 AM, Paul LeBeau <paul.lebeau@gmail.com> 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 still part of the Compositing and Blending spec. You can use it in Canvas, background-blend-mode and mix-blend-mode.[1]

> 
> 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?


It seems very interesting. I fear that giving authors that much control over pixels would make it extremely hard for implementations to optimize. Allowing different operations per channel would make fePiecewise a security risk and we would need to treat it in a similar way as feDisplacementMap[2]. Just that all inputs would not be allowed to be the source (direct or indirect) of any content with potentially sensitive data. This limits the use of fePiecewise drastically.

Greetings,
Dirk

> 
> Paul
> 
> 

[1] http://www.w3.org/TR/2014/CR-compositing-1-20140220/#blendingoverlay
[2] http://dev.w3.org/fxtf/filters/#fedisplacemnentmap-restrictions
Received on Tuesday, 25 March 2014 08:51:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 22 June 2015 03:33:52 UTC