aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Color.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/Color.java')
-rw-r--r--src/main/java/Color.java120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/main/java/Color.java b/src/main/java/Color.java
new file mode 100644
index 0000000..4597b26
--- /dev/null
+++ b/src/main/java/Color.java
@@ -0,0 +1,120 @@
1/**
2 * @author Pacien TRAN-GIRARD
3 * @author Timothée FLOURE
4 */
5public final class Color {
6
7 /**
8 * Returns red component from given packed color.
9 *
10 * @param rgb 32-bits RGB color
11 * @return a float between 0.0 and 1.0
12 * @see #getGreen
13 * @see #getBlue
14 * @see #getRGB(float, float, float)
15 */
16 public static float getRed(int rgb) {
17 // TODO getRed
18 return 0.0f;
19 }
20
21 /**
22 * Returns green component from given packed color.
23 *
24 * @param rgb 32-bits RGB color
25 * @return a float between 0.0 and 1.0
26 * @see #getRed
27 * @see #getBlue
28 * @see #getRGB(float, float, float)
29 */
30 public static float getGreen(int rgb) {
31 // TODO getGreen
32 return 0.0f;
33 }
34
35 /**
36 * Returns blue component from given packed color.
37 *
38 * @param rgb 32-bits RGB color
39 * @return a float between 0.0 and 1.0
40 * @see #getRed
41 * @see #getGreen
42 * @see #getRGB(float, float, float)
43 */
44 public static float getBlue(int rgb) {
45 // TODO getBlue
46 return 0.0f;
47 }
48
49 /**
50 * Returns the average of red, green and blue components from given packed color.
51 *
52 * @param rgb 32-bits RGB color
53 * @return a float between 0.0 and 1.0
54 * @see #getRed
55 * @see #getGreen
56 * @see #getBlue
57 * @see #getRGB(float)
58 */
59 public static float getGray(int rgb) {
60 // TODO getGray
61 return 0.0f;
62 }
63
64 /**
65 * Returns packed RGB components from given red, green and blue components.
66 *
67 * @param red a float between 0.0 and 1.0
68 * @param green a float between 0.0 and 1.0
69 * @param blue a float between 0.0 and 1.0
70 * @return 32-bits RGB color
71 * @see #getRed
72 * @see #getGreen
73 * @see #getBlue
74 */
75 public static int getRGB(float red, float green, float blue) {
76 // TODO getRGB
77 return 0;
78 }
79
80 /**
81 * Returns packed RGB components from given grayscale value.
82 *
83 * @param red a float between 0.0 and 1.0
84 * @param green a float between 0.0 and 1.0
85 * @param blue a float between 0.0 and 1.0
86 * @return 32-bits RGB color
87 * @see #getGray
88 */
89 public static int getRGB(float gray) {
90 // TODO getRGB
91 return 0;
92 }
93
94 /**
95 * Converts packed RGB image to grayscale float image.
96 *
97 * @param image a HxW int array
98 * @return a HxW float array
99 * @see #toRGB
100 * @see #getGray
101 */
102 public static float[][] toGray(int[][] image) {
103 // TODO toGray
104 return null;
105 }
106
107 /**
108 * Converts grayscale float image to packed RGB image.
109 *
110 * @param channels a HxW float array
111 * @return a HxW int array
112 * @see #toGray
113 * @see #getRGB(float)
114 */
115 public static int[][] toRGB(float[][] gray) {
116 // TODO toRGB
117 return null;
118 }
119
120}