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