Skip to content

RGBA.set_hsv(): Properly interpret hue 360° as red

Daniel Boles requested to merge wip/dboles/rgba-set_hsv-360-4 into master
We document an inclusive range of 0..360 degrees, but we divide by 60
and switch over that, only handling 6 cases. So, hue 360° got treated as
300° i.e. magenta, when instead it should be equivalent to 0° i.e. red.

Fix by treating 360° as 0°. Other inputs beyond the documented range are
not specifically handled and will probably still result in nonsense. In
particular, I change >=360 to 0, not just ==360. There is no real reason
for this, except a very similar implementation on Stack Overflow did so,
and my thinking this fixes ==360 while making errors >360 more obvious.

#42 (closed)

Merge request reports