Revision 22814 trunk/libraries/libjni-potrace/src/main/java/org/gvsig/jpotrace/Potrace.java
Potrace.java | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
public class Potrace extends JNIBase { |
26 | 26 |
private static native void vectorizeRasterNat(String filein, String fileout); |
27 |
private static native void vectorizeBufferRasterNat(long[] filein, int width, int height, String fileout); |
|
27 | 28 |
|
28 |
public static void vectorizeRaster(String fileIn, String fileOut) throws PotraceException { |
|
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 { |
|
29 | 37 |
System.out.println("Potrace.vectorizeRaster()"); |
30 | 38 |
|
31 |
if (fileIn == null)
|
|
39 |
if (filein == null)
|
|
32 | 40 |
throw new PotraceException("El nombre del driver es null"); |
33 | 41 |
|
34 | 42 |
if (fileOut == null) |
35 | 43 |
throw new PotraceException("El nombre del driver es null"); |
44 |
|
|
45 |
|
|
46 |
// bufferIn.getWidth(); |
|
47 |
// bufferIn.getHeight(); |
|
48 |
// bufferIn.getElemInt(line, col, band) |
|
36 | 49 |
|
37 |
vectorizeRasterNat(fileIn, fileOut);
|
|
50 |
vectorizeRasterNat(filein, fileOut);
|
|
38 | 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 void vectorizeBufferRaster(long[] bufferIn, int width, int height, String fileOut) throws PotraceException { |
|
63 |
System.out.println("Potrace.vectorizeRaster()"); |
|
64 |
|
|
65 |
if (bufferIn == null) |
|
66 |
throw new PotraceException("El nombre del driver es null"); |
|
67 |
|
|
68 |
if (fileOut == null) |
|
69 |
throw new PotraceException("El nombre del driver es null"); |
|
70 |
|
|
71 |
vectorizeBufferRasterNat(bufferIn, width, height, fileOut); |
|
72 |
} |
|
39 | 73 |
} |
Also available in: Unified diff