W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2011

CSS filter primitive evaluation

From: Chris Marrin <cmarrin@apple.com>
Date: Fri, 14 Oct 2011 16:23:48 -0700
Message-id: <C9A5B6AC-2C30-4AFF-82E7-981B1CA8B4A8@apple.com>
To: public-fx@w3.org

I've been looking at the CSS filter primitives in the spec at https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/publish/Filters.html and would like to make some comments.

1) I believe the grayscale() and sepia() functions are wrong. Dean plans to fix this in the spec.

2) I think grayscale(v) is the same as saturate(1-v), so I think we should remove the grayscale() function. I know it's a very familiar concept. But I think it's ultimately just as easy to think of it as "I want to fully desaturate the color -> saturate(0)" as it is to say, "I want to fully grayscale the image -> grayscale(1)".

3) We currently have hue-rotate() and saturate() functions. I think we should complete the set with a lightness() function, so we can manipulate all channels of the HLS color space. The reason I say HLS rather than HSV is only because "lightness" makes a better name than "value". I don't have enough experience with color models to know which of the two is preferable. 

4) While we're at it, we might want to change the names to saturation() and hue() just for simplicity. It changes them from verbs to nouns, but there are already inconsistencies in this area (e.g., opacity vs sharpen). But I don't that's so bad. Trying to make these consistent might be one of those hobgoblin situations. I don't think using "opacify" or "sharpness" would help clarity any!

5) From the green list of other possible functions, I think we should consider adding all the color matrix functions. This includes brightness, contrast and exposure. We should also add highlights and shadows, since those are the other two color curve adjustments you typically see. All of these are just color matrix operations and if you can accelerate one, you can accelerate all. In fact, you can usually multiply all the consecutive color matrix operations and roll them into one operation.

6) I believe bloom and gloom are in the same class as sharpen (which, in photoshop parlance is an unsharp mask). They do a blur, fiddle with the result and then combine that in some way with the original. Seems like we should support all or none. I would vote for none, at least as a first pass. They're not that easy to accelerate, especially on mobile hardware.

7) I think all the other filters in the green list should be deferred for the future, at least until we've moved forward with implementations of CSS Shaders, which will make everything easier to accelerate.

-----
~Chris
cmarrin@apple.com
Received on Friday, 14 October 2011 23:24:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 14 October 2011 23:24:18 GMT