]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 package org.simantics.modeling.ui.diagram.monitor;\r
2 \r
3 import org.simantics.common.color.Color;\r
4 import org.simantics.databoard.Bindings;\r
5 import org.simantics.db.ReadGraph;\r
6 import org.simantics.db.Resource;\r
7 import org.simantics.db.exception.DatabaseException;\r
8 \r
9 public class RGB implements Color {\r
10         \r
11         double r,g,b;\r
12 \r
13         public RGB(double r, double g, double b) {\r
14                 this.r = r; this.g = g; this.b=b;\r
15         }\r
16         \r
17         public RGB(ReadGraph graph, Resource resource) throws DatabaseException {\r
18                 double[] array = graph.getValue(resource, Bindings.DOUBLE_ARRAY);\r
19                 assert(array.length == 3);\r
20                 r = array[0];\r
21                 g = array[1];\r
22                 b = array[2];\r
23         }\r
24 \r
25         @Override\r
26         public double getR() {\r
27                 return r;\r
28         }\r
29 \r
30         @Override\r
31         public double getG() {\r
32                 return g;\r
33         }\r
34 \r
35         @Override\r
36         public double getB() {\r
37                 return b;\r
38         }\r
39 \r
40         @Override\r
41         public double getA() {\r
42                 throw new UnsupportedOperationException();\r
43         }\r
44 \r
45         @Override\r
46         public double getH() {\r
47                 throw new UnsupportedOperationException();\r
48         }\r
49 \r
50         @Override\r
51         public double getS() {\r
52                 throw new UnsupportedOperationException();\r
53         }\r
54 \r
55         @Override\r
56         public double getV() {\r
57                 throw new UnsupportedOperationException();\r
58         }\r
59         \r
60 }\r
61 \r