tomato-testing/swig
Green Sky 67653bbe50 Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c
git-subtree-dir: external/libwebp/libwebp
git-subtree-split: dd7364c3cefe0f5c0b3c18c3b1887d353f90fc1f
2023-08-02 14:57:22 +02:00
..
libwebp_gc.c Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp_go_wrap.c Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp_java_wrap.c Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp_python_wrap.c Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp.go Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp.jar Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp.py Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
libwebp.swig Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
README.md Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00
setup.py Squashed 'external/libwebp/libwebp/' content from commit dd7364c3c 2023-08-02 14:57:22 +02:00

SWIG bindings

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

Example usage:

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]);
    }
  }
}
 $ javac -cp libwebp.jar libwebp_jni_example.java
 $ java -Djava.library.path=. -cp libwebp.jar:. libwebp_jni_example

Python SWIG bindings:

 $ python setup.py build_ext
 $ python setup.py install --prefix=pylocal

Example usage:

import glob
import sys
sys.path.append(glob.glob('pylocal/lib/python*/site-packages')[0])

from com.google.webp import libwebp
print "libwebp decoder version: %x" % libwebp.WebPGetDecoderVersion()

print "libwebp attributes:"
for attr in dir(libwebp): print attr