]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/RGB.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagram / monitor / RGB.java
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/RGB.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/monitor/RGB.java
new file mode 100644 (file)
index 0000000..ce78847
--- /dev/null
@@ -0,0 +1,61 @@
+package org.simantics.modeling.ui.diagram.monitor;\r
+\r
+import org.simantics.common.color.Color;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+\r
+public class RGB implements Color {\r
+       \r
+       double r,g,b;\r
+\r
+       public RGB(double r, double g, double b) {\r
+               this.r = r; this.g = g; this.b=b;\r
+       }\r
+       \r
+       public RGB(ReadGraph graph, Resource resource) throws DatabaseException {\r
+               double[] array = graph.getValue(resource, Bindings.DOUBLE_ARRAY);\r
+               assert(array.length == 3);\r
+               r = array[0];\r
+               g = array[1];\r
+               b = array[2];\r
+       }\r
+\r
+       @Override\r
+       public double getR() {\r
+               return r;\r
+       }\r
+\r
+       @Override\r
+       public double getG() {\r
+               return g;\r
+       }\r
+\r
+       @Override\r
+       public double getB() {\r
+               return b;\r
+       }\r
+\r
+       @Override\r
+       public double getA() {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+\r
+       @Override\r
+       public double getH() {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+\r
+       @Override\r
+       public double getS() {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+\r
+       @Override\r
+       public double getV() {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+       \r
+}\r
+\r