]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/RGB.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.datatypes / src / org / simantics / datatypes / literal / RGB.java
1 package org.simantics.datatypes.literal;\r
2 \r
3 import org.simantics.common.color.Color;\r
4 import org.simantics.common.utils.CommonUtils;\r
5 import org.simantics.databoard.Bindings;\r
6 import org.simantics.databoard.binding.Binding;\r
7 import org.simantics.databoard.util.Bean;\r
8 \r
9 \r
10 public class RGB {\r
11 \r
12         public static class Integer extends Bean implements Color {\r
13         \r
14         private static final long serialVersionUID = -8574259779076550543L;\r
15 \r
16         public static final Binding BINDING = Bindings.getBindingUnchecked(Integer.class);\r
17                 \r
18                 public int red;\r
19                 public int green;\r
20                 public int blue;\r
21                 \r
22                 public Integer(int r, int g, int b) {\r
23                         super(BINDING);\r
24                         this.red = r; this.green = g; this.blue = b;\r
25                 }\r
26                 \r
27                 @Override\r
28                 public String toString() {\r
29                         return "RGB.Integer[r=" + red + " ,g=" + green + " ,b=" + blue + "]";\r
30                 }\r
31 \r
32                 @Override\r
33                 public double getR() {\r
34                         return CommonUtils.convertColor256ToDouble(red);\r
35                 }\r
36 \r
37                 @Override\r
38                 public double getG() {\r
39                         return CommonUtils.convertColor256ToDouble(green);\r
40                 }\r
41 \r
42                 @Override\r
43                 public double getB() {\r
44                         return CommonUtils.convertColor256ToDouble(blue);\r
45                 }\r
46 \r
47                 @Override\r
48                 public double getA() {\r
49                         return 0;\r
50                 }\r
51 \r
52                 @Override\r
53                 public double getH() {\r
54                         throw new UnsupportedOperationException();\r
55                 }\r
56 \r
57                 @Override\r
58                 public double getS() {\r
59                         throw new UnsupportedOperationException();\r
60                 }\r
61 \r
62                 @Override\r
63                 public double getV() {\r
64                         throw new UnsupportedOperationException();\r
65                 }\r
66                 \r
67         }\r
68         \r
69 }\r