Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / raster / lib / legend / api / colorinterpretation / ColorInterpretation.java @ 44831

History | View | Annotate | Download (7.72 KB)

1
package org.gvsig.raster.lib.legend.api.colorinterpretation;
2

    
3
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
4
import org.gvsig.tools.observer.Observer;
5
import org.gvsig.tools.observer.WeakReferencingObservable;
6
import org.gvsig.tools.persistence.Persistent;
7
import org.gvsig.tools.lang.Cloneable;
8

    
9
/**
10
 * @author fdiaz
11
 *
12
 */
13
public interface ColorInterpretation extends WeakReferencingObservable, Persistent, Cloneable, Observer {
14

    
15
    // Color interpretation identifiers
16
    public static final String RED_BAND = "Red";
17
    public static final String GREEN_BAND = "Green";
18
    public static final String BLUE_BAND = "Blue";
19
    public static final String ALPHA_BAND = "Alpha";
20
    public static final String GRAY_BAND = "Gray";
21

    
22
    // public static final String RED_GREEN_BAND = "Red_Green"; // YELLOW_BAND?
23
    // public static final String RED_BLUE_BAND = "Red_Blue"; // MAGENTA_BAND?
24
    // public static final String GREEN_BLUE_BAND = "Green_Blue"; // CYAN_BAND?
25

    
26
    public static final String HUE_BAND = "Hue";
27
    public static final String SATURATION_BAND = "Saturation";
28
    public static final String LIGHTNESS_BAND = "Lightness";
29

    
30
    public static final String CYAN_BAND = "Cyan";
31
    public static final String MAGENTA_BAND = "Magenta";
32
    public static final String YELLOW_BAND = "Yellow";
33
    public static final String BLACK_BAND = "Black";
34

    
35
    public static final String YCBCR_Y_BAND = "YCbCr_Y";
36
    public static final String YCBCR_CB_BAND = "YCbCr_Cb";
37
    public static final String YCBCR_CR_BAND = "YCbCr_Cr";
38

    
39
    public static final String PALETTE_BAND = "Palette";
40

    
41
    public static final String UNDEFINED_BAND = "Undefined";
42

    
43
    // Constants to initialize the color interpretation
44
    public static final String RGB = "RGB";
45
    public static final String BGR = "BGR";
46
    public static final String ARGB = "ARGB";
47
    public static final String GRAYSCALE = "GRAYSCALE";
48
    public static final String PALETTE = "PALETTE";
49
    public static final String HSL = "HSL";
50
    public static final String CMYK = "CMYK";
51
    public static final String YCBCR = "YCBCR";
52

    
53
    /**
54
     * Set color interpretation value to band
55
     *
56
     * @param band
57
     *            Band
58
     * @param value
59
     *            Color interpretation value
60
     */
61
    public void setColorInterpValue(int band, String value);
62

    
63
    /**
64
     * @return Returns the number of assigned color interpretation values
65
     */
66
    public int length();
67

    
68
    /**
69
     * @return Returns true if the color values are
70
     *         assigned to any band of the image or the values Gray or Palette
71
     *         are
72
     *         assigned.
73
     */
74
    public boolean hasInterpretation();
75

    
76
    /**
77
     * @return Returns true if the color interpretation is BGR, that is, the
78
     *         three first bands of the image are Blue, Green and Red.
79
     *
80
     */
81
    public boolean isBGR();
82

    
83
    /**
84
     * @return Returns true if the color interpretation is RGB, that is, the
85
     *         three first bands of the image are Red, Green and Blue.
86
     */
87
    public boolean isRGB();
88

    
89
    /**
90
     * @return Returns true if the color interpretation is ARGB, that is, the
91
     *         four first bands of the image are Red, Green, Blue and Alpha.
92
     */
93
    public boolean isRGBA();
94

    
95
    /**
96
     * @return Returns true if the color interpretation has at least one RED
97
     *         band, one GREEN band and one BLUE band.
98
     */
99
    public boolean hasAnyRGBBand();
100

    
101
    /**
102
     * @return Returns true if the color interpretation is Gray
103
     */
104
    public boolean isGray();
105

    
106
    /**
107
     * @return Returns true if the color interpretation is HSL
108
     */
109
    public boolean isHSL();
110

    
111
    /**
112
     * @return Returns true if the color interpretation is CMYK
113
     */
114
    public boolean isCMYK();
115

    
116
    /**
117
     * @return Returns true if the color interpretation YCBCR
118
     */
119
    public boolean isYCBCR();
120

    
121
    /**
122
     * @param band
123
     * @return Returns true if the selected band has color
124
     *         interpretation
125
     *         and false otherwise
126
     */
127
    public boolean isColorInterpretation(int band);
128

    
129
    /**
130
     * @param band
131
     * @return Returns true if the selected band has gray interpretation and
132
     *         false
133
     *         otherwise
134
     */
135
    public boolean isGrayInterpretation(int band);
136

    
137
    /**
138
     * @param band
139
     * @return Returns true if the selected band has palette interpretation and
140
     *         false
141
     *         otherwise
142
     */
143
    public boolean isPaletteInterpretation(int band);
144

    
145
    /**
146
     *
147
     *
148
     * @param band
149
     * @return Returns true if the selected band has alpha interpretation and
150
     *         false
151
     *         otherwise
152
     */
153
    public boolean isAlphaInterpretation(int band);
154

    
155
    /**
156
     * Get color interpretation of band.
157
     *
158
     * @param i
159
     *            Number of band
160
     * @return Color interpretation defined of band
161
     */
162
    public String get(int i);
163

    
164
    /**
165
     * Gets the band position defined with color interpretation received as
166
     * parameter.
167
     *
168
     * @param id
169
     *            Color interpretation definition
170
     * @return Index of band
171
     */
172
    public int getBand(String id);
173

    
174
    /**
175
     * Gets if color interpretation is defined
176
     *
177
     * @return True if color interpretation is defined, false if it is undefined
178
     */
179
    public boolean isUndefined();
180

    
181
    /**
182
     * Gets color interpretation of all bands
183
     *
184
     * @return Array with color interpretation
185
     */
186
    public String[] getValues();
187

    
188
    /**
189
     * @return Returns true if one band has the "Alpha" label
190
     */
191
    public boolean hasAlphaBand();
192

    
193
    /**
194
     * @return Returns the number of band with the label "Alpha"
195
     */
196
    public int getAlphaBand();
197

    
198
    /**
199
     * Adds a color interpretation to this color interpretation. The result is
200
     * the addition of color interpretations.
201
     *
202
     * @param ci
203
     */
204
    public void addColorInterpretation(ColorInterpretation ci);
205

    
206
    /**
207
     * Copy from the color interpretation received as parameter
208
     *
209
     * @param colorInterpretation
210
     */
211
    public void copyFrom(ColorInterpretation colorInterpretation);
212

    
213
    /**
214
     * @return Returns true if the color interpretation has at least one Gray
215
     *         band.
216
     */
217
    boolean hasAnyGrayBand();
218

    
219
    /**
220
     * @return Returns true if the color interpretation has at least one Palette
221
     *         band.
222
     */
223
    public boolean hasAnyPaletteBand();
224

    
225
    /**
226
     * @return Returns true if the color interpretation has at least one HUE
227
     *         band, one SATURATION band or one LIGHTNESS band.
228
     */
229
    public boolean hasAnyHSLBand();
230

    
231
    /**
232
     * @return Returns true if the color interpretation has at least one HUE
233
     *         band, one SATURATION band or one LIGHTNESS band.
234
     */
235
    public boolean hasAnyCMYKBand();
236

    
237
    /**
238
     * @return Returns true if the color interpretation has at least one YCBCR-CB
239
     *         band, one YCBCR-CR band or one YCBCR-Y band.
240
     */
241
    public boolean hasAnyYCBCRBand();
242

    
243
    /**
244
     * Sets the colorTable.
245
     * @param colorTable
246
     */
247
    public void setPalette(ColorTable colorTable);
248

    
249
    /**
250
     * Sets the band which will apply the color table
251
     * @param band
252
     */
253
    public void setPaletteBand(int band);
254

    
255
    /**
256
     * If there are not color table, return -1
257
     *
258
     * @return the band in which will apply  the color table
259
     */
260
    public int getPaletteBand();
261

    
262
    /**
263
     * @return the color table
264
     */
265
    public ColorTable getPalette();
266

    
267
    /**
268
     * @return true if paletteBand and colorTable are not null.
269
     */
270
    public boolean isPalette();
271

    
272
    /**
273
     * @return Returns true if the color interpretation has at least one Color band
274
     * (not Gray, Palette nor Alpha)
275
     *
276
     */
277
    public boolean hasAnyColorInterpretationBand();
278
}
279