2011-05-07 03:03:02 +02:00
|
|
|
Building:
|
|
|
|
=========
|
|
|
|
|
|
|
|
JNI SWIG bindings:
|
|
|
|
------------------
|
|
|
|
$ gcc -shared -fPIC -fno-strict-aliasing -O2 \
|
|
|
|
-I/path/to/your/jdk/includes \
|
|
|
|
libwebp_java_wrap.c \
|
|
|
|
-lwebp \
|
|
|
|
-o libwebp_jni.so
|
|
|
|
|
|
|
|
-------------------------------------- BEGIN PSEUDO EXAMPLE
|
2011-06-10 20:48:48 +02:00
|
|
|
import com.google.webp.libwebp;
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
2011-05-07 03:03:02 +02:00
|
|
|
|
|
|
|
public class libwebp_jni_example {
|
|
|
|
static {
|
|
|
|
System.loadLibrary("webp_jni");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-06-10 20:48:48 +02:00
|
|
|
* usage: java -cp libwebp.jar:. libwebp_jni_example
|
2011-05-07 03:03:02 +02:00
|
|
|
*/
|
|
|
|
public static void main(String argv[]) {
|
|
|
|
final int version = libwebp.WebPGetDecoderVersion();
|
|
|
|
System.out.println("libwebp version: " + Integer.toHexString(version));
|
2011-06-10 20:48:48 +02:00
|
|
|
|
|
|
|
System.out.println("libwebp methods:");
|
|
|
|
final Method[] libwebpMethods = libwebp.class.getDeclaredMethods();
|
|
|
|
for (int i = 0; i < libwebpMethods.length; i++) {
|
|
|
|
System.out.println(libwebpMethods[i]);
|
|
|
|
}
|
2011-05-07 03:03:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
-------------------------------------- END PSEUDO EXAMPLE
|
|
|
|
|
|
|
|
$ javac -cp libwebp.jar libwebp_jni_example.java
|
|
|
|
$ java -Djava.library.path=. -cp libwebp.jar:. libwebp_jni_example
|