Fix HSV.RGBA sector overflow
This commit is contained in:
parent
0865c28965
commit
acec0f6222
@ -42,6 +42,8 @@ func (hsv HSV) RGBA () (r, g, b, a uint32) {
|
|||||||
|
|
||||||
h := clamp01(hsv.H) * 360
|
h := clamp01(hsv.H) * 360
|
||||||
sector := int(h / 60)
|
sector := int(h / 60)
|
||||||
|
// otherwise when given 1.0 for H, sector would overflow to 6
|
||||||
|
if sector > 5 { sector = 5 }
|
||||||
offset := (h / 60) - float64(sector)
|
offset := (h / 60) - float64(sector)
|
||||||
|
|
||||||
p := component(v * (1 - s))
|
p := component(v * (1 - s))
|
||||||
|
Loading…
Reference in New Issue
Block a user