Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / io / raster / RemoveBandsImageFilter.java @ 2669

History | View | Annotate | Download (2.55 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.io.raster;
25

    
26
import java.awt.Image;
27
import java.awt.image.BufferedImage;
28

    
29

    
30
/**
31
 *
32
 * @author Nacho Brodin (brodin_ign@gva.es)
33
 */
34
public class RemoveBandsImageFilter extends RemoveBandsFilter {
35
    /**
36
     * Constructor
37
     *
38
     */
39
    public RemoveBandsImageFilter() {
40
        super();
41
    }
42

    
43
    /* (non-Javadoc)
44
     * @see org.cresques.io.raster.IRasterFilter#pre()
45
     */
46
    public void pre() {
47
        //Obtenci?n de par?metros
48
        this.image = (Image) params.get("raster");
49

    
50
        height = image.getHeight(null);
51
        width = image.getWidth(null);
52
        super.pre();
53
    }
54

    
55
    /* (non-Javadoc)
56
     * @see org.cresques.io.raster.IRasterFilter#process(int, int)
57
     */
58
    public void process(int x, int y) {
59
        int px = ((BufferedImage) image).getRGB(x, y);
60
        px = px & mascara;
61
        ((BufferedImage) image).setRGB(x, y, px);
62
    }
63

    
64
    /* (non-Javadoc)
65
     * @see org.cresques.io.raster.IRasterFilter#getInRasterDataType()
66
     */
67
    public int getInRasterDataType() {
68
        return RasterBuf.TYPE_IMAGE;
69
    }
70

    
71
    /* (non-Javadoc)
72
     * @see org.cresques.io.raster.IRasterFilter#getOutRasterDataType()
73
     */
74
    public int getOutRasterDataType() {
75
        return RasterBuf.TYPE_IMAGE;
76
    }
77

    
78
    /* (non-Javadoc)
79
     * @see org.cresques.io.raster.IRasterFilter#post()
80
     */
81
    public void post() {
82
        super.post();
83
    }
84

    
85
    /* (non-Javadoc)
86
     * @see org.cresques.io.raster.RasterFilter#processLine(int)
87
     */
88
    public void processLine(int y) {
89
    }
90

    
91
    public Object getResult(String name) {
92
        if (name.equals("raster")) {
93
            return (Object) this.image;
94
        } else {
95
            return null;
96
        }
97
    }
98
}