mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
54f2170a15
Wrap WebPEncode???* to provide an interface similar to decode. As only WebPGetEncoderVersion is wrapped directly from encode.h avoid including it in the swig file to reduce %ignore's. This change also removes unnecessary incremental decoding related enums. Change-Id: I0b5424026aa6ae012c6a29ad2f2301c2681ca301
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
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
|
|
import com.google.webp.libwebp;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
public class libwebp_jni_example {
|
|
static {
|
|
System.loadLibrary("webp_jni");
|
|
}
|
|
|
|
/**
|
|
* usage: java -cp libwebp.jar:. libwebp_jni_example
|
|
*/
|
|
public static void main(String argv[]) {
|
|
final int version = libwebp.WebPGetDecoderVersion();
|
|
System.out.println("libwebp version: " + Integer.toHexString(version));
|
|
|
|
System.out.println("libwebp methods:");
|
|
final Method[] libwebpMethods = libwebp.class.getDeclaredMethods();
|
|
for (int i = 0; i < libwebpMethods.length; i++) {
|
|
System.out.println(libwebpMethods[i]);
|
|
}
|
|
}
|
|
}
|
|
-------------------------------------- END PSEUDO EXAMPLE
|
|
|
|
$ javac -cp libwebp.jar libwebp_jni_example.java
|
|
$ java -Djava.library.path=. -cp libwebp.jar:. libwebp_jni_example
|