aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Color.java
blob: 9e05039f6f9ca6178671eed52c89ece4c597b334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
 * @author Pacien TRAN-GIRARD
 * @author Timothée FLOURE
 */
public final class Color {

    /**
     * Returns red component from given packed color.
     *
     * @param rgb 32-bits RGB color
     * @return a float between 0.0 and 1.0
     * @see #getGreen
     * @see #getBlue
     * @see #getRGB(float, float, float)
     */
    public static float getRed(int rgb) {
        // TODO getRed
        return 0.0f;
    }

    /**
     * Returns green component from given packed color.
     *
     * @param rgb 32-bits RGB color
     * @return a float between 0.0 and 1.0
     * @see #getRed
     * @see #getBlue
     * @see #getRGB(float, float, float)
     */
    public static float getGreen(int rgb) {
        // TODO getGreen
        return 0.0f;
    }

    /**
     * Returns blue component from given packed color.
     *
     * @param rgb 32-bits RGB color
     * @return a float between 0.0 and 1.0
     * @see #getRed
     * @see #getGreen
     * @see #getRGB(float, float, float)
     */
    public static float getBlue(int rgb) {
        // TODO getBlue
        return 0.0f;
    }

    /**
     * Returns the average of red, green and blue components from given packed color.
     *
     * @param rgb 32-bits RGB color
     * @return a float between 0.0 and 1.0
     * @see #getRed
     * @see #getGreen
     * @see #getBlue
     * @see #getRGB(float)
     */
    public static float getGray(int rgb) {
        // TODO getGray
        return 0.0f;
    }

    /**
     * Returns packed RGB components from given red, green and blue components.
     *
     * @param red   a float between 0.0 and 1.0
     * @param green a float between 0.0 and 1.0
     * @param blue  a float between 0.0 and 1.0
     * @return 32-bits RGB color
     * @see #getRed
     * @see #getGreen
     * @see #getBlue
     */
    public static int getRGB(float red, float green, float blue) {
        // TODO getRGB
        return 0;
    }

    /**
     * Returns packed RGB components from given grayscale value.
     *
     * @param gray   a float between 0.0 and 1.0
     * @return 32-bits RGB color
     * @see #getGray
     */
    public static int getRGB(float gray) {
        // TODO getRGB
        return 0;
    }

    /**
     * Converts packed RGB image to grayscale float image.
     *
     * @param image a HxW int array
     * @return a HxW float array
     * @see #toRGB
     * @see #getGray
     */
    public static float[][] toGray(int[][] image) {
        // TODO toGray
        return null;
    }

    /**
     * Converts grayscale float image to packed RGB image.
     *
     * @param gray a HxW float array
     * @return a HxW int array
     * @see #toGray
     * @see #getRGB(float)
     */
    public static int[][] toRGB(float[][] gray) {
        // TODO toRGB
        return null;
    }

}