Color.HSBtoRGB() will wrap hue for us.
It is documented that hue = hue - (float)Math.floor(hue); It's pointless for us to check if it's over 1f.
This commit is contained in:
@@ -73,13 +73,9 @@ public class Colorization
|
|||||||
*/
|
*/
|
||||||
public int recolorColor (float[] hsv)
|
public int recolorColor (float[] hsv)
|
||||||
{
|
{
|
||||||
// for hue, we wrap around
|
// hue will be wrapped-around by HSBtoRGB, we don't need to do it
|
||||||
float hue = hsv[0] + offsets[0];
|
float hue = hsv[0] + offsets[0];
|
||||||
if (hue > 1.0) {
|
// the others we must clip
|
||||||
hue -= 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise we clip
|
|
||||||
float sat = Math.min(Math.max(hsv[1] + offsets[1], 0), 1);
|
float sat = Math.min(Math.max(hsv[1] + offsets[1], 0), 1);
|
||||||
float val = Math.min(Math.max(hsv[2] + offsets[2], 0), 1);
|
float val = Math.min(Math.max(hsv[2] + offsets[2], 0), 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user