App
BlendMode.java
Go to the documentation of this file.
1 package mhr.appcore.blending;
2 
6 public enum BlendMode {
7 
10 
11  // Brush-only:
14 
15  // Darken:
21 
22  // Lighten:
28 
29  // Contrast:
37 
38  // Comparative:
43 
44  // HSL:
49 
50  private static final BlendMode[] lut = new BlendMode[29];
51  static {
52  for (BlendMode mode : BlendMode.values()) {
53  lut[mode.getValue()] = mode;
54  }
55  }
56 
57  private final int nativeEnumValue;
58 
63  private BlendMode(int nativeEnumValue) {
64  this.nativeEnumValue = nativeEnumValue;
65  }
66 
71  public int getValue() {
72  return nativeEnumValue;
73  }
74 
80  public static BlendMode fromValue(int index) {
81  try {
82  return lut[index];
83  } catch (IndexOutOfBoundsException exc) {
85  }
86  }
87 
88 }