1 package jogamp.opengl.util.pngj; 2 3 import java.util.HashMap; 4 5 /** 6 * Internal PNG predictor filter, or strategy to select it. 7 * 8 */ 9 public enum FilterType { 10 /** 11 * No filter. 12 */ 13 FILTER_NONE(0), 14 /** 15 * SUB filter (uses same row) 16 */ 17 FILTER_SUB(1), 18 /** 19 * UP filter (uses previous row) 20 */ 21 FILTER_UP(2), 22 /** 23 * AVERAGE filter 24 */ 25 FILTER_AVERAGE(3), 26 /** 27 * PAETH predictor 28 */ 29 FILTER_PAETH(4), 30 /** 31 * Default strategy: select one of the above filters depending on global 32 * image parameters 33 */ 34 FILTER_DEFAULT(-1), 35 /** 36 * Aggressive strategy: select one of the above filters trying each of the 37 * filters (every 8 rows) 38 */ 39 FILTER_AGGRESSIVE(-2), 40 /** 41 * Very aggressive strategy: select one of the above filters trying each of 42 * the filters (for every row!) 43 */ 44 FILTER_VERYAGGRESSIVE(-3), 45 /** 46 * Uses all fiters, one for lines, cyciclally. Only for tests. 47 */ 48 FILTER_CYCLIC(-50), 49 50 /** 51 * Not specified, placeholder for unknown or NA filters. 52 */ 53 FILTER_UNKNOWN(-100), ; 54 public final int val; 55 FilterType(final int val)56 private FilterType(final int val) { 57 this.val = val; 58 } 59 60 private static HashMap<Integer, FilterType> byVal; 61 62 static { 63 byVal = new HashMap<Integer, FilterType>(); 64 for (final FilterType ft : values()) { byVal.put(ft.val, ft)65 byVal.put(ft.val, ft); 66 } 67 } 68 getByVal(final int i)69 public static FilterType getByVal(final int i) { 70 return byVal.get(i); 71 } 72 73 } 74