App

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

- File List
- File Members

BlendMode.java
Go to the documentation of this file.
1 package mhr.appcore.blending;
2
6 public enum BlendMode {
7
8 BLEND_MODE_NORMAL(0),
9 BLEND_MODE_DISSOLVE(1),
10
11 // Brush-only:
12 BLEND_MODE_BEHIND(2),
13 BLEND_MODE_CLEAR(3),
14
15 // Darken:
16 BLEND_MODE_DARKEN(4),
17 BLEND_MODE_MULTIPLY(5),
18 BLEND_MODE_COLOR_BURN(6),
19 BLEND_MODE_LINEAR_BURN(7),
20 BLEND_MODE_DARKER_COLOR(8),
21
22 // Lighten:
23 BLEND_MODE_LIGHTEN(9),
24 BLEND_MODE_SCREEN(10),
25 BLEND_MODE_COLOR_DODGE(11),
26 BLEND_MODE_LINEAR_DODGE_ADD(12),
27 BLEND_MODE_LIGHTER_COLOR(13),
28
29 // Contrast:
30 BLEND_MODE_OVERLAY(14),
31 BLEND_MODE_SOFT_LIGHT(15),
32 BLEND_MODE_HARD_LIGHT(16),
33 BLEND_MODE_VIVID_LIGHT(17),
34 BLEND_MODE_LINEAR_LIGHT(18),
35 BLEND_MODE_PIN_LIGHT(19),
36 BLEND_MODE_HARD_MIX(20),
37
38 // Comparative:
39 BLEND_MODE_DIFFERENCE(21),
40 BLEND_MODE_EXCLUSION(22),
41 BLEND_MODE_SUBTRACT(23),
42 BLEND_MODE_DIVIDE(24),
43
44 // HSL:
45 BLEND_MODE_HUE(25),
46 BLEND_MODE_SATURATION(26),
47 BLEND_MODE_COLOR(27),
48 BLEND_MODE_LUMINOSITY(28);
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) {
84 return BlendMode.BLEND_MODE_NORMAL;
85 }
86 }
87
88 }