|
@@ -95,11 +95,12 @@ func AdjustHue(img image.Image, shift float64) *image.NRGBA {
|
|
}
|
|
}
|
|
|
|
|
|
shift = math.Min(math.Max(shift, -180), 180)
|
|
shift = math.Min(math.Max(shift, -180), 180)
|
|
- shift = shift / -360
|
|
|
|
|
|
+ summand := shift / -360
|
|
|
|
|
|
return AdjustFunc(img, func(c color.NRGBA) color.NRGBA {
|
|
return AdjustFunc(img, func(c color.NRGBA) color.NRGBA {
|
|
h, s, l := rgbToHSL(c.R, c.G, c.B)
|
|
h, s, l := rgbToHSL(c.R, c.G, c.B)
|
|
- h = math.Mod(h+shift, 1.0)
|
|
|
|
|
|
+ h += summand
|
|
|
|
+ h = math.Mod(h, 1.0)
|
|
r, g, b := hslToRGB(h, s, l)
|
|
r, g, b := hslToRGB(h, s, l)
|
|
return color.NRGBA{r, g, b, c.A}
|
|
return color.NRGBA{r, g, b, c.A}
|
|
})
|
|
})
|