Revision 1560 branches/v02_desarrollo/libraries/libCq CMS for java.old/src/org/cresques/io/GeoRasterFile.java

View differences:

GeoRasterFile.java
14 14

  
15 15
import org.cresques.cts.ICoordTrans;
16 16
import org.cresques.cts.IProjection;
17
import org.cresques.io.raster.PixelFilter;
18
import org.cresques.io.raster.SimplePixelFilter;
17 19
import org.cresques.px.Extent;
18 20
import org.cresques.px.IObjList;
19 21
import org.cresques.px.PxContour;
......
52 54
	 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
53 55
	 */
54 56

  
55
	class PixelFilter {
56
		boolean debug = false;
57
		int transparente = 0x10ffff00;
58
		int orColor = 0xff000000;
59
		int umbral = 0xf0f0f0;
60
		private int alpha = 0xff;
61
		
62
		/**
63
		 * Constructor para el Oleico
64
		 */
65

  
66
		public PixelFilter(int alpha) {
67
			transparente = 0x10ffff00;
68
			setAlpha(alpha);
69
			//orColor = 0xff000000 | (alpha * 0x1000000);
70
			umbral = 0xf0f0f0;
71
		}
72

  
73
		/**
74
		 * Constructor.
75
		 * 
76
		 * @param trans Color que sustituye a los pixeles filtrados
77
		 * @param or	M?scara que se aplica a los pixeles restantes
78
		 * @param pxMax	Umbral que determina los pixeles.
79
		 */
80
			
81
		public PixelFilter(int trans, int or, int pxMax) {
82
			transparente = trans;
83
			setAlpha(orColor / 0x1000000);
84
			orColor = or;
85
			umbral = pxMax;
86
		}
87
		
88
		public void setAlpha(int alpha) {
89
			this.alpha = alpha;
90
			orColor = alpha * 0x1000000;
91
		}
92
		public int getAlpha() { return alpha; }
93
		
94
		/**
95
		 * Filtra una l?nea de pixeles.
96
		 * 
97
		 * @param pRGBArray
98
		 */
99
		
100
		public void filterLine(int [] pRGBArray) {
101
			for (int i=0; i<pRGBArray.length; i++) {
102
				if (debug)
103
					System.out.print(""+i+":"+Integer.toHexString(pRGBArray[i])+",");
104
				if (pRGBArray[i]  >= umbral)
105
					pRGBArray[i] = transparente;
106
				else
107
					pRGBArray[i] |= orColor;
108
			}
109
			if (debug)
110
				System.out.println("");
111
		}
112
	}
113

  
114
	class SimplePixelFilter extends PixelFilter {
115
		public SimplePixelFilter(int alpha) {
116
			super(alpha);
117
		}
118
		public void filterLine(int [] pRGBArray) {
119
			for (int i=0; i<pRGBArray.length; i++) {
120
				if (debug)
121
					System.out.print(""+i+":"+Integer.toHexString(pRGBArray[i])+",");
122
				pRGBArray[i] |= orColor;
123
			}
124
			if (debug)
125
				System.out.println("");
126
		}
127
	}
128

  
57
	
129 58
	private static TreeMap supportedExtensions = null;
130 59
	protected Component updatable = null;
131 60
	protected boolean doTransparency = false;

Also available in: Unified diff