root / branches / piloto3d / libraries / libCq CMS for java.old / src / org / cresques / filter / bands / RasterToImageFilter.java @ 9523
History | View | Annotate | Download (2.98 KB)
1 |
/*
|
---|---|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications.
|
3 |
*
|
4 |
* Copyright (C) 2004-5.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* cresques@gmail.com
|
23 |
*/
|
24 |
package org.cresques.filter.bands; |
25 |
|
26 |
import java.awt.image.BufferedImage; |
27 |
|
28 |
import org.cresques.filter.RasterFilter; |
29 |
import org.cresques.io.data.RasterBuf; |
30 |
|
31 |
|
32 |
/**
|
33 |
* Renderiza el raster.
|
34 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
35 |
*/
|
36 |
public class RasterToImageFilter extends RasterFilter { |
37 |
protected BufferedImage image; |
38 |
protected int alpha; |
39 |
protected int alphaReal; |
40 |
protected int rgb; |
41 |
|
42 |
/**
|
43 |
* Constructor
|
44 |
*
|
45 |
*/
|
46 |
public RasterToImageFilter() {
|
47 |
} |
48 |
|
49 |
/* (non-Javadoc)
|
50 |
* @see org.cresques.io.raster.IRasterFilter#pre()
|
51 |
*/
|
52 |
public void pre() { |
53 |
//Obtenemos par?metros
|
54 |
this.raster = (RasterBuf) params.get("raster"); |
55 |
this.alphaReal = ((Integer) params.get("alpha")).intValue(); |
56 |
this.height = raster.getHeight();
|
57 |
this.width = raster.getWidth();
|
58 |
this.alpha = (alphaReal & 0xff) << 24; |
59 |
image = new BufferedImage(raster.getWidth(), raster.getHeight(), |
60 |
BufferedImage.TYPE_INT_ARGB);
|
61 |
} |
62 |
|
63 |
/* (non-Javadoc)
|
64 |
* @see org.cresques.px.PxRaster.RasterFilter#process(int, int)
|
65 |
*/
|
66 |
public void process(int x, int y) { |
67 |
|
68 |
} |
69 |
|
70 |
public void processSuperSampling(int x, int y) { |
71 |
|
72 |
|
73 |
} |
74 |
|
75 |
/* (non-Javadoc)
|
76 |
* @see org.cresques.io.raster.IRasterFilter#getResult(java.lang.String)
|
77 |
*/
|
78 |
public Object getResult(String name) { |
79 |
if (name.equals("raster")) { |
80 |
return (Object) image; |
81 |
} else {
|
82 |
return null; |
83 |
} |
84 |
} |
85 |
|
86 |
/* (non-Javadoc)
|
87 |
* @see org.cresques.px.PxRaster.RasterFilter#processLines(int)
|
88 |
*/
|
89 |
public void processLine(int y) { |
90 |
|
91 |
} |
92 |
|
93 |
/* (non-Javadoc)
|
94 |
* @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
|
95 |
*/
|
96 |
public int getInRasterDataType() { |
97 |
return raster.getDataType();
|
98 |
} |
99 |
|
100 |
/* (non-Javadoc)
|
101 |
* @see org.cresques.io.raster.IRasterFilter#getOutRasterDataType()
|
102 |
*/
|
103 |
public int getOutRasterDataType() { |
104 |
return RasterBuf.TYPE_IMAGE;
|
105 |
} |
106 |
|
107 |
/* (non-Javadoc)
|
108 |
* @see org.cresques.io.raster.IRasterFilter#post()
|
109 |
*/
|
110 |
public void post() { |
111 |
} |
112 |
} |