[filter-effects] Color clamping of intermediate filter primitive results

Hi,

Currently Filter Effect require to clamp all resulting pixel color values of filter primitives to the range 0..255. This was done to have specified color values for each filter primitive output at any time.

However, this approach prevents implementations from further improvements. The specification currently has the following note for shorthand filters[1]:

""
Note: The grayscale, sepia, saturate, hue-rotate, invert, opacity, brightness and contrast filter functions can be represented by color matrices. If the former named filter functions are chained together, UAs can optimize the performance by multiplying these filter functions to one color matrix and apply the resulting color matrix instead of each filter function separately.
""

Since the shorthand filter build on top of SVG Filters, this is actually not correct. Implementations need to apply each shorthand filter on the content first to clamp the result after each filter operation.

"saturate(200%) saturate(50%)" would look different depending if you clamp color values for each primitive or don't.

I wonder if we can relax the requirement of clamping in some cases and would suggest that we do not force clamping if two following filter primitives can be collapsed to one filter primitive. We would need to clarify which primitives can be combined together of course.

Greetings,
Dirk

[1] http://dev.w3.org/fxtf/filters/#FilterProperty

Received on Tuesday, 23 July 2013 05:16:28 UTC