]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/Color.java
Sync git svn branch with SVN repository r33269.
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / color / Color.java
index b1f67289065c7a99d60ad339fb4b4727a6a59c56..da0251da1063a153601574d1a891488e35bafc5a 100644 (file)
@@ -52,14 +52,14 @@ public class Color implements Comparable<Color>{
         this.h = h;\r
         this.s = s;\r
         this.v = v;\r
-        updateRGB();    \r
+        updateRGB();   \r
     }\r
     \r
     public Color(double h, double s, double v) {\r
         this.h = (float)h;\r
         this.s = (float)s;\r
         this.v = (float)v;\r
-        updateRGB();     \r
+        updateRGB();    \r
     }\r
     \r
     public Color(RGB rgb) {\r
@@ -223,7 +223,8 @@ public class Color implements Comparable<Color>{
         }\r
 \r
         if (s == 0.f) {\r
-            h = Float.NaN; // saturation is 0 -> achromatic color\r
+            //h = Float.NaN; // saturation is 0 -> achromatic color\r
+               h = 0.f;\r
         } else {\r
             if (tr == v) {\r
                 h = 60.f * (tg - tb);\r
@@ -248,14 +249,9 @@ public class Color implements Comparable<Color>{
      */\r
     private void updateRGB() {\r
         if (s == 0.f) {\r
-            //if (Float.isNaN(h)) {\r
-                h = Float.NaN;\r
-                r = floatToInt(v);\r
-                g = floatToInt(v);\r
-                b = floatToInt(v);\r
-            //} else {\r
-            //    throw new RuntimeException("Saturation is 0 -> Hue must be undefined");\r
-            //}\r
+            r = floatToInt(v);\r
+            g = floatToInt(v);\r
+            b = floatToInt(v);\r
         } else {\r
             while (h < 0.f)\r
                h+= 360.f;\r