X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fcolor%2FColor.java;h=da0251da1063a153601574d1a891488e35bafc5a;hp=b1f67289065c7a99d60ad339fb4b4727a6a59c56;hb=bf75fd9;hpb=21f879fcd72d7749836fb64375094ef29573fe8c diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/Color.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/Color.java index b1f672890..da0251da1 100644 --- a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/Color.java +++ b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/Color.java @@ -52,14 +52,14 @@ public class Color implements Comparable{ this.h = h; this.s = s; this.v = v; - updateRGB(); + updateRGB(); } public Color(double h, double s, double v) { this.h = (float)h; this.s = (float)s; this.v = (float)v; - updateRGB(); + updateRGB(); } public Color(RGB rgb) { @@ -223,7 +223,8 @@ public class Color implements Comparable{ } if (s == 0.f) { - h = Float.NaN; // saturation is 0 -> achromatic color + //h = Float.NaN; // saturation is 0 -> achromatic color + h = 0.f; } else { if (tr == v) { h = 60.f * (tg - tb); @@ -248,14 +249,9 @@ public class Color implements Comparable{ */ private void updateRGB() { if (s == 0.f) { - //if (Float.isNaN(h)) { - h = Float.NaN; - r = floatToInt(v); - g = floatToInt(v); - b = floatToInt(v); - //} else { - // throw new RuntimeException("Saturation is 0 -> Hue must be undefined"); - //} + r = floatToInt(v); + g = floatToInt(v); + b = floatToInt(v); } else { while (h < 0.f) h+= 360.f;