tl; dr Error converting colors from floats (inside the filter) to bytes (everywhere).
So this is a little more complicated than spec provides a good formula for hue rotation matrices, for example, for 180 degrees (excluding alpha and shifts):
-0.5747 1.4304 0.1444 0.4252 0.4304 0.1444 0.4252 1.4304 -0.8556
Please note: if you multiply this by yourself, you get (up to four decimal places):
0.9999 0.0001 0.0000 0.0000 1.0 0.0 0.0000 0.0000 1.0
which is very close to the identity matrix or the null transform.
That would be fine, except that the browser converts back to RGB between each filter. See what happens when we shade: bright red:
-0.5747 1.4304 0.1444 1 -0.5747 0.4252 0.4304 0.1444 * 0 = 0.4252 0.4252 1.4304 -0.8556 0 0.4252
We get a color that cannot be represented in RGB with values ββfrom 0 to 255. Thus, it is 0 0.4235 0.4235 and rounded to 0 0.4235 0.4235 during the RGB conversion, and when it is rotated again, we end with a dark, unsaturated red, 0.6667 0.2431 0.2431 instead of a bright pure the red we started with.
imuli Oct 02 '17 at 20:46 on 2017-10-02 20:46
source share