w3c / fxtf-drafts

Mirror of https://hg.fxtf.org/drafts
https://drafts.fxtf.org/
Other
68 stars 49 forks source link

[filter-effects-1] hue-rotate color space could be explained better #473

Open pshaughn opened 1 year ago

pshaughn commented 1 year ago

https://drafts.fxtf.org/filter-effects/#funcdef-filter-hue-rotate says just "Applies a hue rotation on the input image", which I think most first-time readers would generally expect to be a rotation in something like RGB or HSV or HSL space. The matrix is specified in https://drafts.fxtf.org/filter-effects/#ref-for-attr-valuedef-type-huerotate without any explanation of how the coeffecients were decided. This seems to be a rotation in YIQ colorspace or something similar, and the spec could be more explicit about that.

svgeesus commented 4 months ago

This seems to be a rotation of an sRGB cube about an axis, where the axis is the achromatic corner diagonal from black to white.

https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle

This is of course bogus as calculations are done on gamma-encoded, not linear-light, values. But the math was constrained by compatibility with long-established industry practice, and would not be seen as a good solution today.