App

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

- File List
- File Members

NativeType.java
Go to the documentation of this file.
1 package mhr.appcore.bitmap;
2
6 public enum NativeType {
7
8 INVALID_TYPE(0), MONO_8_BIT(1), RGBA_8_BIT(2), MONO_16_BIT(3), RGBA_16_BIT(4);
9
10 private static final NativeType[] lut = new NativeType[5];
11 static {
12 for (NativeType type : NativeType.values()) {
13 lut[type.getValue()] = type;
14 }
15 }
16
17 private final int nativeEnumValue;
18
23 private NativeType(int nativeEnumValue) {
24 this.nativeEnumValue = nativeEnumValue;
25 }
26
31 public int getValue() {
32 return nativeEnumValue;
33 }
34
40 public static NativeType fromValue(int nativeValue) {
41 try {
42 return lut[nativeValue];
43 } catch (IndexOutOfBoundsException exc) {
44 return NativeType.INVALID_TYPE;
45 }
46 }
47 }