Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-potrace / src / main / java / org / gvsig / jpotrace / Potrace.java @ 23060

History | View | Annotate | Download (2.38 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.jpotrace;
20
/**
21
 * 
22
 * @version 31/07/2008
23
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
24
 */
25
public class Potrace extends JNIBase {
26
        private static native void vectorizeRasterNat(String filein, String fileout);
27
        private static native double[] vectorizeBufferRasterNat(int[] filein, int width, int height);
28

    
29
        /**
30
         * Vectoriza un fichero pasado por parametro y lo guarda en fileOut
31
         * 
32
         * @param filein
33
         * @param fileOut
34
         * @throws PotraceException
35
         */
36
        public static void vectorizeRaster(String filein, String fileOut) throws PotraceException {
37
                System.out.println("Potrace.vectorizeRaster()");
38

    
39
                if (filein == null)
40
                        throw new PotraceException("El nombre del driver es null");
41

    
42
                if (fileOut == null)
43
                        throw new PotraceException("El nombre del driver es null");
44
                
45
                
46
//                bufferIn.getWidth();
47
//                bufferIn.getHeight();
48
//                bufferIn.getElemInt(line, col, band)
49

    
50
                vectorizeRasterNat(filein, fileOut);
51
        }
52
        
53
        /**
54
         * Vectoriza un buffer pasado por parametro y lo guarda en fileOut. Hay que
55
         * especificar el ancho y alto del buffer y el buffer ha de ser pasado en el
56
         * formato que soporta potrace, que es en forma de bits.
57
         * 
58
         * @param filein
59
         * @param fileOut
60
         * @throws PotraceException
61
         */
62
        public static double[] vectorizeBufferRaster(int[] bufferIn, int width, int height) throws PotraceException {
63
                if (bufferIn == null)
64
                        throw new PotraceException("El nombre del driver es null");
65

    
66
                return vectorizeBufferRasterNat(bufferIn, width, height);
67
        }
68
}