Statistics
| Revision:

root / trunk / libraries / libCq_CMS_praster / src / org / cresques / filter / bands / RasterDoubleToImageFilter.java @ 8026

History | View | Annotate | Download (1.88 KB)

1
package org.cresques.filter.bands;
2

    
3
public class RasterDoubleToImageFilter extends RasterToImageFilter {
4
        
5
        private double[]                 px = {0, 0, 0, 255};
6
        
7
        public int getInRasterDataType() {
8
                // TODO Auto-generated method stub
9
                return super.getInRasterDataType();
10
        }
11

    
12
        public int getOutRasterDataType() {
13
                // TODO Auto-generated method stub
14
                return super.getOutRasterDataType();
15
        }
16

    
17
        public Object getResult(String name) {
18
                // TODO Auto-generated method stub
19
                return super.getResult(name);
20
        }
21

    
22
        public void post() {
23
                // TODO Auto-generated method stub
24
                super.post();
25
        }
26

    
27
        public void pre() {
28
                // TODO Auto-generated method stub
29
                super.pre();
30
        }
31

    
32
        public void process(int col, int line) {
33
                raster.getElemDouble(line, col, px);
34
        rgb = (alpha & (((int)(255) & 0xff) << 24)) | (int)((Math.round(px[0]) & 0xff) << 16) |
35
        (int)((Math.round(px[1]) & 0xff) << 8) | (int)(Math.round(px[2]) & 0xff);
36
        /*rgb = (alpha & (int)((Math.round(px[3]) & 0xff) << 24)) | (int)((Math.round(px[0]) & 0xff) << 16) |
37
        (int)((Math.round(px[1]) & 0xff) << 8) | (int)(Math.round(px[2]) & 0xff);*/
38

    
39
        image.setRGB(col, line, rgb);
40
        }
41

    
42
        public void processLine(int y) {
43
                // TODO Auto-generated method stub
44
                super.processLine(y);
45
        }
46

    
47
        public void processSuperSampling(int col, int line) {
48
                raster.getElemDouble(line, col, px);
49
        rgb = (alpha & ((((int)(255)) & 0xff) << 24)) | (int)((Math.round(px[0]) & 0xff) << 16) |
50
                (int)((Math.round(px[1]) & 0xff) << 8) | (int)(Math.round(px[2]) & 0xff);
51
        /*rgb = (alpha & (int)((Math.round(px[3]) & 0xff) << 24)) | (int)((Math.round(px[0]) & 0xff) << 16) |
52
            (int)((Math.round(px[1]) & 0xff) << 8) | (int)(Math.round(px[2]) & 0xff);*/
53
        
54
        for(int j = col; j < raster.getWidth() && j < (col + stepX[contX + 1]); j++)
55
                        for(int i = line; i < raster.getHeight() && i < (line + stepY[contY + 1]); i++)
56
                                image.setRGB(j, i, rgb);
57
        }
58

    
59
}