Revision 2308 org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/grid/filter/band/ColorBalanceCMYByteFilter.java

View differences:

ColorBalanceCMYByteFilter.java
25 25
/**
26 26
 * Filtro de balance de colores para tipo de datos byte.
27 27
 *
28
 * @version 30/11/2007
29 28
 * @author Nacho Brodin (nachobrodin@gmail.com)
30 29
 */
31 30
public class ColorBalanceCMYByteFilter extends ColorBalanceCMYFilter {
32
	/*
33
	 * (non-Javadoc)
34
	 * @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#process(int, int)
35
	 */
31

  
36 32
	public void process(int col, int line) {
37
		byte[] value = new byte[3];
33
		byte[] value = new byte[4];
34
		value[3] = (byte)255;
38 35
		for (int i = 0; i < renderBands.length; i++) 
39
			value[i] = raster.getElemByte(line, col, renderBands[i]);
36
			if(renderBands[i] != -1)
37
				value[i] = raster.getElemByte(line, col, renderBands[i]);
40 38
		
41 39
		double[] cmyk = colorConversion.RGBtoCMYK(value[0] & 0xff, value[1] & 0xff, value[2] & 0xff, 1);
42 40
		double lum = colorConversion.getLuminosity(value[0] & 0xff, value[1] & 0xff, value[2] & 0xff);
......
57 55
			int[] v1 = colorConversion.HSLtoRGB((int)(((int)hsl[0]) & 0xffffffff), 
58 56
												(int)(((int)hsl[1]) & 0xffffffff), 
59 57
												(int)(((int)hsl[2]) & 0xffffffff));
60
			byte[] v = new byte[3];
58
			byte[] v = new byte[4];
61 59
			for (int band = 0; band < 3; band++)
62 60
				v[band] = (byte)v1[band];
63
			rasterResult.setElemByte(line, col, v);
61
			v[3] = value[3];
62
			getOutputBuffer().setElemByte(line, col, v);
64 63
		} else
65
			rasterResult.setElemByte(line, col, value);
64
			getOutputBuffer().setElemByte(line, col, value);
65
		
66
		writeAlphaBand(line, col);
66 67
	}
67 68
}

Also available in: Unified diff