[filter-effects] A piecewise filter

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.

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?

Paul

Received on Tuesday, 25 March 2014 07:53:33 UTC