]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.datatypes/src/org/simantics/datatypes/conversion/RGBIntegerColorAdapter.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.datatypes / src / org / simantics / datatypes / conversion / RGBIntegerColorAdapter.java
diff --git a/bundles/org.simantics.datatypes/src/org/simantics/datatypes/conversion/RGBIntegerColorAdapter.java b/bundles/org.simantics.datatypes/src/org/simantics/datatypes/conversion/RGBIntegerColorAdapter.java
new file mode 100644 (file)
index 0000000..51a781b
--- /dev/null
@@ -0,0 +1,45 @@
+package org.simantics.datatypes.conversion;\r
+\r
+import org.simantics.datatypes.adt.Color;\r
+import org.simantics.datatypes.literal.RGB;\r
+\r
+public class RGBIntegerColorAdapter implements Color {\r
+       \r
+    public RGB.Integer rgb;\r
+    \r
+       @Override\r
+       public double getR() {\r
+               return (1.0/512.0) + (1.0/256.0) * (double)rgb.red;\r
+       }\r
+       \r
+       @Override\r
+       public double getG() {\r
+               return (1.0/512.0) + (1.0/256.0) * (double)rgb.green;\r
+       }\r
+       \r
+       @Override\r
+       public double getB() {\r
+               return (1.0/512.0) + (1.0/256.0) * (double)rgb.blue;\r
+       }\r
+       \r
+       @Override\r
+       public double getA() {\r
+               return 0;\r
+       }\r
+       \r
+       @Override\r
+       public double getH() {\r
+               return 0;\r
+       }\r
+       \r
+       @Override\r
+       public double getS() {\r
+               return 0;\r
+       }\r
+       \r
+       @Override\r
+       public double getV() {\r
+               return 0;\r
+       }\r
+       \r
+}
\ No newline at end of file