App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

ColorMode.java
Go to the documentation of this file.
1 package mhr.appcore.bitmap;
2
6 public enum ColorMode {
7
8 // Musí být kladné a definované
9 INVALID_COLOR_MODE(0), MONO(1), RGBA(2), HSVA(3), HLSA(4);
10
11 private static final ColorMode[] lut = new ColorMode[5];
12
13 static {
14 for (ColorMode mode : ColorMode.values()) {
15 lut[mode.getValue()] = mode;
16 }
17 }
18
19 private final int nativeEnumValue;
20
25 private ColorMode(int nativeEnumValue) {
26 this.nativeEnumValue = nativeEnumValue;
27 }
28
33 public int getValue() {
34 return nativeEnumValue;
35 }
36
42 public static ColorMode fromValue(int index) {
43 try {
44 return lut[index];
45 } catch (IndexOutOfBoundsException exc) {
46 return ColorMode.INVALID_COLOR_MODE;
47 }
48 }
49 }