svn-gvsig-desktop / branches / v10 / libraries / libCq CMS for java.old / src / org / cresques / filter / enhancement / BrightnessShortFilter.java @ 9056
History | View | Annotate | Download (1.19 KB)
1 |
package org.cresques.filter.enhancement; |
---|---|
2 |
|
3 |
import java.awt.Image; |
4 |
|
5 |
import org.cresques.filter.RasterBuf; |
6 |
|
7 |
|
8 |
/**
|
9 |
*
|
10 |
* @author Miguel Ángel Querol Carratalá <querol_mig@gva.es>
|
11 |
*
|
12 |
*/
|
13 |
public class BrightnessShortFilter extends BrightnessFilter{ |
14 |
|
15 |
public BrightnessShortFilter(){
|
16 |
super();
|
17 |
} |
18 |
|
19 |
public void pre(){ |
20 |
exec = true;
|
21 |
this.raster = (RasterBuf) params.get("raster"); |
22 |
height = raster.getHeight(); |
23 |
width = raster.getWidth(); |
24 |
this.incrBrillo = ((Integer) params.get("incrBrillo")).intValue(); |
25 |
|
26 |
super.pre();
|
27 |
} |
28 |
|
29 |
|
30 |
|
31 |
public void process(int x, int y) { |
32 |
raster.getElemInt(x, y, px); |
33 |
|
34 |
for(int i = 0 ; i < 3 ; i++){ |
35 |
if((px[i] + incrBrillo) > 255) |
36 |
px[i] = 255;
|
37 |
else if((px[i] + incrBrillo) < 0) |
38 |
px[i] = 0;
|
39 |
else
|
40 |
px[i] += incrBrillo; |
41 |
} |
42 |
|
43 |
raster.setElemInt(x, y, px); |
44 |
|
45 |
} |
46 |
|
47 |
public void processLine(int y) { |
48 |
// TODO Auto-generated method stub
|
49 |
|
50 |
} |
51 |
|
52 |
public int getInRasterDataType() { |
53 |
return RasterBuf.TYPE_SHORT;
|
54 |
} |
55 |
|
56 |
public int getOutRasterDataType() { |
57 |
return RasterBuf.TYPE_SHORT;
|
58 |
} |
59 |
|
60 |
public Object getResult(String name) { |
61 |
if (name.equals("raster")) { |
62 |
return (Object) this.raster; |
63 |
} else {
|
64 |
return null; |
65 |
} |
66 |
} |
67 |
|
68 |
} |