Statistics
| Revision:

root / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / io / raster / PercentTailTrimImageFilter.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
 * Proceso del filtro de recorte de colas aplicado a objetos Image
32
 * @author Nacho Brodin (brodin_ign@gva.es)
33
 *
34
 */
35
public class PercentTailTrimImageFilter extends PercentTailTrimFilter {
36
    public PercentTailTrimImageFilter() {
37
    }
38

    
39
    /**
40
     * Obtiene par?metros para el filtro y obtiene el ancho y alto de
41
     * la imagen sobre la que se aplica el filtro
42
     */
43
    public void pre() {
44
        //Obtenci?n de par?metros
45
        this.image = (Image) params.get("raster");
46
        height = image.getHeight(null);
47
        width = image.getWidth(null);
48
        super.pre();
49
    }
50

    
51
    /**
52
     * Carga sobre el vector de muestras los valores de estas cogidos
53
     * de la imagen
54
     */
55
    public void process(int x, int y) {
56
        int pt = ((BufferedImage) image).getRGB(x, y);
57
        sample[0][count] = ((pt & 0xff0000) >> 16) & 0xff;
58
        sample[1][count] = ((pt & 0xff00) >> 8) & 0xff;
59
        sample[2][count] = (pt & 0xff);
60
        count++;
61
    }
62

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

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

    
77
    /* (non-Javadoc)
78
     * @see org.cresques.io.raster.RasterFilter#processLine(int)
79
     */
80
    public void processLine(int y) {
81
    }
82

    
83
    /* (non-Javadoc)
84
     * @see org.cresques.io.raster.IRasterFilter#post()
85
     */
86
    public void post() {
87
        super.post();
88
    }
89
}