|
@@ -1,124 +0,0 @@
|
1
|
|
-/*
|
2
|
|
- * Copyright (c) 2006-2014 DMDirc Developers
|
3
|
|
- *
|
4
|
|
- * Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
|
- * of this software and associated documentation files (the "Software"), to deal
|
6
|
|
- * in the Software without restriction, including without limitation the rights
|
7
|
|
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
|
- * copies of the Software, and to permit persons to whom the Software is
|
9
|
|
- * furnished to do so, subject to the following conditions:
|
10
|
|
- *
|
11
|
|
- * The above copyright notice and this permission notice shall be included in
|
12
|
|
- * all copies or substantial portions of the Software.
|
13
|
|
- *
|
14
|
|
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
|
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
|
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
|
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
|
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
|
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
|
- * SOFTWARE.
|
21
|
|
- */
|
22
|
|
-
|
23
|
|
-package com.dmdirc.ui;
|
24
|
|
-
|
25
|
|
-/**
|
26
|
|
- * A colour represented by an RGB triple. This implementation is immutable.
|
27
|
|
- */
|
28
|
|
-public class Colour {
|
29
|
|
-
|
30
|
|
- /** The colour white. */
|
31
|
|
- public static final Colour WHITE = new Colour(255, 255, 255);
|
32
|
|
- /** The colour light gray. */
|
33
|
|
- public static final Colour LIGHT_GRAY = new Colour(192, 192, 192);
|
34
|
|
- /** The colour gray. */
|
35
|
|
- public static final Colour GRAY = new Colour(128, 128, 128);
|
36
|
|
- /** The colour dark gray. */
|
37
|
|
- public static final Colour DARK_GRAY = new Colour(64, 64, 64);
|
38
|
|
- /** The colour black. */
|
39
|
|
- public static final Colour BLACK = new Colour(0, 0, 0);
|
40
|
|
- /** The colour red. */
|
41
|
|
- public static final Colour RED = new Colour(255, 0, 0);
|
42
|
|
- /** The colour pink. */
|
43
|
|
- public static final Colour PINK = new Colour(255, 175, 175);
|
44
|
|
- /** The colour orange. */
|
45
|
|
- public static final Colour ORANGE = new Colour(255, 200, 0);
|
46
|
|
- /** The colour yellow. */
|
47
|
|
- public static final Colour YELLOW = new Colour(255, 255, 0);
|
48
|
|
- /** The colour green. */
|
49
|
|
- public static final Colour GREEN = new Colour(0, 255, 0);
|
50
|
|
- /** The colour magenta. */
|
51
|
|
- public static final Colour MAGENTA = new Colour(255, 0, 255);
|
52
|
|
- /** The colour cyan. */
|
53
|
|
- public static final Colour CYAN = new Colour(0, 255, 255);
|
54
|
|
- /** The colour blue. */
|
55
|
|
- public static final Colour BLUE = new Colour(0, 0, 255);
|
56
|
|
- /** The intensity of the red component of this colour (0-255). */
|
57
|
|
- private final int red;
|
58
|
|
- /** The intensity of the green component of this colour (0-255). */
|
59
|
|
- private final int green;
|
60
|
|
- /** The intensity of the blue component of this colour (0-255). */
|
61
|
|
- private final int blue;
|
62
|
|
-
|
63
|
|
- /**
|
64
|
|
- * Creates a new Colour instance with the given RGB values.
|
65
|
|
- *
|
66
|
|
- * @param red The intensity of the red component of the colour (0-255).
|
67
|
|
- * @param green The intensity of the green component of the colour (0-255).
|
68
|
|
- * @param blue The intensity of the blue component of the colour (0-255).
|
69
|
|
- */
|
70
|
|
- public Colour(final int red, final int green, final int blue) {
|
71
|
|
- this.red = red;
|
72
|
|
- this.green = green;
|
73
|
|
- this.blue = blue;
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- /**
|
77
|
|
- * Gets the intensity of the blue component of this colour.
|
78
|
|
- *
|
79
|
|
- * @return The intensity on a scale of 0-255.
|
80
|
|
- */
|
81
|
|
- public int getBlue() {
|
82
|
|
- return blue;
|
83
|
|
- }
|
84
|
|
-
|
85
|
|
- /**
|
86
|
|
- * Gets the intensity of the green component of this colour.
|
87
|
|
- *
|
88
|
|
- * @return The intensity on a scale of 0-255.
|
89
|
|
- */
|
90
|
|
- public int getGreen() {
|
91
|
|
- return green;
|
92
|
|
- }
|
93
|
|
-
|
94
|
|
- /**
|
95
|
|
- * Gets the intensity of the red component of this colour.
|
96
|
|
- *
|
97
|
|
- * @return The intensity on a scale of 0-255.
|
98
|
|
- */
|
99
|
|
- public int getRed() {
|
100
|
|
- return red;
|
101
|
|
- }
|
102
|
|
-
|
103
|
|
- @Override
|
104
|
|
- public boolean equals(final Object obj) {
|
105
|
|
- if (obj == null || getClass() != obj.getClass()) {
|
106
|
|
- return false;
|
107
|
|
- }
|
108
|
|
-
|
109
|
|
- final Colour other = (Colour) obj;
|
110
|
|
-
|
111
|
|
- return this.red == other.getRed() && this.green == other.getGreen()
|
112
|
|
- && this.blue == other.getBlue();
|
113
|
|
- }
|
114
|
|
-
|
115
|
|
- @Override
|
116
|
|
- public int hashCode() {
|
117
|
|
- int hash = 7;
|
118
|
|
- hash = 37 * hash + this.red;
|
119
|
|
- hash = 37 * hash + this.green;
|
120
|
|
- hash = 37 * hash + this.blue;
|
121
|
|
- return hash;
|
122
|
|
- }
|
123
|
|
-
|
124
|
|
-}
|