Revision 23060 trunk/libraries/libjni-potrace/src/main/native/jpotrace/potrace.c
potrace.c | ||
---|---|---|
45 | 45 |
/** |
46 | 46 |
* Parte de jni para vectorizar un buffer |
47 | 47 |
*/ |
48 |
JNIEXPORT void JNICALL Java_org_gvsig_jpotrace_Potrace_vectorizeBufferRasterNat(JNIEnv *env, jclass clase, jintArray bufferIn, jint width, jint height, jstring fileout) {
|
|
48 |
JNIEXPORT jdoubleArray JNICALL Java_org_gvsig_jpotrace_Potrace_vectorizeBufferRasterNat(JNIEnv *env, jclass clase, jintArray bufferIn, jint width, jint height) {
|
|
49 | 49 |
int i; |
50 | 50 |
jint *cbufferIn; |
51 |
const char *outfile; |
|
51 |
double *values; |
|
52 |
jsize size; |
|
53 |
jdoubleArray jvalues; |
|
52 | 54 |
|
53 | 55 |
cbufferIn = (*env)->GetIntArrayElements(env, bufferIn, NULL); |
54 | 56 |
|
55 |
outfile = (*env)->GetStringUTFChars(env, fileout, 0); |
|
57 |
values = vectorizarBuffer((long *) cbufferIn, width, height); |
|
58 |
size = (jsize) values[0]; |
|
59 |
jvalues = (*env)->NewDoubleArray(env, size); |
|
60 |
(*env)->SetDoubleArrayRegion(env, jvalues, 0, size, values); |
|
56 | 61 |
|
57 |
vectorizarBuffer((long *) cbufferIn, width, height, outfile);
|
|
62 |
(*env)->ReleaseIntArrayElements(env, bufferIn, cbufferIn, 0);
|
|
58 | 63 |
|
59 |
(*env)->ReleaseStringUTFChars(env, fileout, outfile); |
|
60 |
(*env)->ReleaseIntArrayElements(env, bufferIn, cbufferIn, 0); |
|
64 |
return jvalues; |
|
61 | 65 |
} |
Also available in: Unified diff