From 54f2170a15913e3eaaeb92fd92729705b10f883a Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 10 Jun 2011 11:48:48 -0700 Subject: [PATCH] swig/java: basic encode support 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 --- README | 9 +- swig/README | 15 +- swig/libwebp.i | 123 ++++++++++++++ swig/libwebp.jar | Bin 5541 -> 1924 bytes swig/libwebp_java_wrap.c | 342 ++++++++++++++++++++++++++++++--------- 5 files changed, 411 insertions(+), 78 deletions(-) diff --git a/README b/README index 272f381b..1ecefb5e 100644 --- a/README +++ b/README @@ -82,13 +82,20 @@ SWIG bindings: To generate language bindings from swig/libwebp.i swig-1.3 (http://www.swig.org) is required. 2.0 may work, but has not been tested. -Currently from the decode interface the following functions are mapped: +Currently from the following functions are mapped: +Decode: WebPGetDecoderVersion WebPGetInfo WebPDecodeRGB WebPDecodeRGBA WebPDecodeBGR WebPDecodeBGRA +Encode: + WebPGetEncoderVersion + WebPEncodeRGB + WebPEncodeRGBA + WebPEncodeBGR + WebPEncodeBGRA Java bindings: diff --git a/swig/README b/swig/README index 8b4298b4..959f3ec9 100644 --- a/swig/README +++ b/swig/README @@ -10,8 +10,9 @@ JNI SWIG bindings: -o libwebp_jni.so -------------------------------------- BEGIN PSEUDO EXAMPLE -import com.google.webp.*; -import java.io.*; +import com.google.webp.libwebp; + +import java.lang.reflect.Method; public class libwebp_jni_example { static { @@ -19,13 +20,17 @@ public class libwebp_jni_example { } /** - * usage: java -cp libwebp.jar:. - * libwebp_jni_example <input.webp> <output.ppm> + * 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 diff --git a/swig/libwebp.i b/swig/libwebp.i index df5afcf8..d6073493 100644 --- a/swig/libwebp.i +++ b/swig/libwebp.i @@ -21,6 +21,9 @@ %include "constraints.i" %include "typemaps.i" +//------------------------------------------------------------------------------ +// Decoder specific + %ignore WEBP_WEBP_DECODE_H_; // FIXME for these to be available returned_buffer_size() would need to be // made more intelligent. @@ -32,6 +35,8 @@ %ignore WebPDecodeYUVInto; // incremental decoding +%ignore WEBP_CSP_MODE; +%ignore VP8StatusCode; %ignore WebPIDecGetYUV; %ignore WebPINew; %ignore WebPIDecoder; @@ -56,6 +61,11 @@ %newobject WebPDecodeBGRA; %typemap(newfree) uint8_t* "free($1);" +//------------------------------------------------------------------------------ +// Encoder specific + +int WebPGetEncoderVersion(void); + #ifdef SWIGJAVA %include "arrays_java.i"; %include "enums.swg" /*NB: requires JDK-1.5+ @@ -81,6 +91,7 @@ */ %{ #include "webp/decode.h" +#include "webp/encode.h" #define FillMeInAsSizeCannotBeDeterminedAutomatically \ (result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0) @@ -95,6 +106,10 @@ static jint returned_buffer_size( { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA", 1 }, { NULL, 0 } }; const struct sizemap *p; @@ -109,7 +124,115 @@ static jint returned_buffer_size( return size; } + +typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, uint8_t** output); + +static uint8_t* encode(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, + WebPEncodeFunction encfn, + int* output_size, int* unused) { + uint8_t *output = NULL; + const size_t image_size = + encfn(rgb, width, height, stride, quality_factor, &output); + // the values of following two will be interpreted by returned_buffer_size() + // as 'width' and 'height' in the size calculation. + *output_size = image_size; + *unused = 1; + return image_size ? output : NULL; +} %} +//------------------------------------------------------------------------------ +// libwebp/encode wrapper functions + +%apply int *INPUT { int *unused1, int *unused2 } +%apply int *OUTPUT { int *output_size } + +// free the buffer returned by these functions after copying into +// the native type +%newobject wrap_WebPEncodeRGB; +%newobject wrap_WebPEncodeBGR; +%newobject wrap_WebPEncodeRGBA; +%newobject wrap_WebPEncodeBGRA; + +%inline %{ +// Changes the return type of WebPEncode* to more closely match Decode*. +// This also makes it easier to wrap the output buffer in a native type rather +// than dealing with the return pointer. +// The additional parameters are to allow reuse of returned_buffer_size(), +// unused2 and output_size will be used in this case. +static uint8_t* wrap_WebPEncodeRGB( + const uint8_t* rgb, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(rgb, width, height, stride, quality_factor, + WebPEncodeRGB, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeBGR( + const uint8_t* bgr, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(bgr, width, height, stride, quality_factor, + WebPEncodeBGR, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeRGBA( + const uint8_t* rgba, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(rgba, width, height, stride, quality_factor, + WebPEncodeRGBA, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeBGRA( + const uint8_t* bgra, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(bgra, width, height, stride, quality_factor, + WebPEncodeBGRA, output_size, unused2); +} +%} + +#ifdef SWIGJAVA +// There's no reason to call these directly +%javamethodmodifiers wrap_WebPEncodeRGB "private"; +%javamethodmodifiers wrap_WebPEncodeBGR "private"; +%javamethodmodifiers wrap_WebPEncodeRGBA "private"; +%javamethodmodifiers wrap_WebPEncodeBGRA "private"; + +%pragma(java) modulecode=%{ + private static final int UNUSED = 1; + private static int outputSize[] = { 0 }; + + public static byte[] WebPEncodeRGB(byte[] rgb, + int width, int height, int stride, + float quality_factor) { + return wrap_WebPEncodeRGB( + rgb, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor); + } + + public static byte[] WebPEncodeBGR(byte[] bgr, + int width, int height, int stride, + float quality_factor) { + return wrap_WebPEncodeBGR( + bgr, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor); + } + + public static byte[] WebPEncodeRGBA(byte[] rgba, + int width, int height, int stride, + float quality_factor) { + return wrap_WebPEncodeRGBA( + rgba, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor); + } + + public static byte[] WebPEncodeBGRA(byte[] bgra, + int width, int height, int stride, + float quality_factor) { + return wrap_WebPEncodeBGRA( + bgra, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor); + } +%} +#endif /* SWIGJAVA */ + // All functions, constants, etc. not named above in %ignore will be wrapped %include "webp/decode.h" diff --git a/swig/libwebp.jar b/swig/libwebp.jar index 03b6d353a809190d7613fa2e137d233974678c5e..9f3184588d2aace6c4e8e800b0c8e927944eccac 100644 GIT binary patch delta 1243 zcmZ3g-NMfs;LXe;!oUH9i$l&&Z&`lx}u?7hg+vx$6M$0 z-51V|s*wqiDUnH$&)z6c6PE-B%tlK5b?m-EO-1=cyH@ z8k1^ruf^re$h)~t_~ISo*~h0PSDQ&KeZM4AW^d{fo&9?Qg*wt#FZEg)wJ^JOQ`9b> zsbrH{U`I|=7os@ zFAYvfKMqMxbaFVs?RN3(=1&)U#F?iAm()%=Au-XUbp9D7C-V!Fz0;RX z_A;8mv-Hq%j+$vPd!IT_x%nTNF4S5sl4l;gMjFjBi_ypXR#hLfYTb`x8~nppU;qPab<$*;)XOvb{^^Hjv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-i;7R>}Et-#~Vq?QeSQ$`4*!UMQ|De-QvQhI6 zi7@8Dom;Q^)kc^%c{vBORFTg!B;}#YhGXszzJxRF&{L$^yTRS1=*#LjZ*=p<43AAQ z?UNh?HD?D(Ex$jIPij708l>0exR=FV;|$7jL@WKNi+k6a_8nw{a9dP(Alds%t}@z zhmW49g&Iq^MK6~y((jGPWxL*Y>rlQGK5#S~ms}Q4$%#|3hjk8_q;1fK^%<$X_|N+w z)9)cuQic7En$9=WiWbVUgHr2csYIL?+8zaP7E&=8-6e`dj#qMVl@`in_9liCGPZ^a zWuS8)*B(0#9JZw7ZSNj`!v8?sKrmO3s{uC;Wp-cnRQ2q-Qck~26z+N&2&8bJi>XCu z#p4E7u4v}_zU+61423&9BwfDgdC%9e8E)R)t-a0Qhx0__t~Dzy%d2qCcdu=Q6^{uO zv=@>`zQj#i?K&6$A?-D<|ryXGnGncvhy!bEFDLkbXI? z^t%boQiMGBSHfoa>Y@){_2(DY+yl|Hpq?r+^{7AlT6p)UdBa7gW3{DAog#ZRTEcMS z5xK*I2?f-q(M_=T3ieRv=-rs^u%330iW>$3xi+f(X*9Yo2y_ee1B3d~^_>BN{Q9vx zN=dmb9QAzl%=$@_6uISg!*uO?BmBF^1s5;x%PC?zKKca zN|d_t#n2xWp>yTwyGfiazlHvwL!DE}YpcN;x}<>$ICWd8e~ z@^iu;2g{44I^g{~;e}!Hr(yr+%s)2di=`5uLHcv47c&34)F0c$c_0670wn)Vc%iHR qT-%RFoauX>v(@|=+CSI!PpWU-MqT+5&Up~w*>e>O0PrR||MWjc(AG5o diff --git a/swig/libwebp_java_wrap.c b/swig/libwebp_java_wrap.c index 58c55762..0c904fa1 100644 --- a/swig/libwebp_java_wrap.c +++ b/swig/libwebp_java_wrap.c @@ -818,6 +818,7 @@ jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz) { #include "webp/decode.h" +#include "webp/encode.h" #define FillMeInAsSizeCannotBeDeterminedAutomatically \ (result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0) @@ -832,6 +833,10 @@ static jint returned_buffer_size( { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA", 1 }, + { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA", 1 }, { NULL, 0 } }; const struct sizemap *p; @@ -847,11 +852,276 @@ static jint returned_buffer_size( return size; } +typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, uint8_t** output); + +static uint8_t* encode(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, + WebPEncodeFunction encfn, + int* output_size, int* unused) { + uint8_t *output = NULL; + const size_t image_size = + encfn(rgb, width, height, stride, quality_factor, &output); + // the values of following two will be interpreted by returned_buffer_size() + // as 'width' and 'height' in the size calculation. + *output_size = image_size; + *unused = 1; + return image_size ? output : NULL; +} + + +// Changes the return type of WebPEncode* to more closely match Decode*. +// This also makes it easier to wrap the output buffer in a native type rather +// than dealing with the return pointer. +// The additional parameters are to allow reuse of returned_buffer_size(), +// unused2 and output_size will be used in this case. +static uint8_t* wrap_WebPEncodeRGB( + const uint8_t* rgb, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(rgb, width, height, stride, quality_factor, + WebPEncodeRGB, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeBGR( + const uint8_t* bgr, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(bgr, width, height, stride, quality_factor, + WebPEncodeBGR, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeRGBA( + const uint8_t* rgba, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(rgba, width, height, stride, quality_factor, + WebPEncodeRGBA, output_size, unused2); +} + +static uint8_t* wrap_WebPEncodeBGRA( + const uint8_t* bgra, int* unused1, int* unused2, int* output_size, + int width, int height, int stride, float quality_factor) { + return encode(bgra, width, height, stride, quality_factor, + WebPEncodeBGRA, output_size, unused2); +} + #ifdef __cplusplus extern "C" { #endif +SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetEncoderVersion(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)WebPGetEncoderVersion(); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) { + jbyteArray jresult = 0 ; + uint8_t *arg1 = (uint8_t *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int arg6 ; + int arg7 ; + float arg8 ; + jbyte *jarr1 ; + int temp4 ; + uint8_t *result = 0 ; + + (void)jenv; + (void)jcls; + if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0; + arg2 = (int *)&jarg2; + arg3 = (int *)&jarg3; + { + if (!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); + return 0; + } + if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return 0; + } + arg4 = &temp4; + } + arg5 = (int)jarg5; + arg6 = (int)jarg6; + arg7 = (int)jarg7; + arg8 = (float)jarg8; + result = (uint8_t *)wrap_WebPEncodeRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically); + SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1); + { + jint jvalue = (jint)temp4; + (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue); + } + free(arg1); + + + + free(result); + return jresult; +} + + +SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) { + jbyteArray jresult = 0 ; + uint8_t *arg1 = (uint8_t *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int arg6 ; + int arg7 ; + float arg8 ; + jbyte *jarr1 ; + int temp4 ; + uint8_t *result = 0 ; + + (void)jenv; + (void)jcls; + if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0; + arg2 = (int *)&jarg2; + arg3 = (int *)&jarg3; + { + if (!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); + return 0; + } + if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return 0; + } + arg4 = &temp4; + } + arg5 = (int)jarg5; + arg6 = (int)jarg6; + arg7 = (int)jarg7; + arg8 = (float)jarg8; + result = (uint8_t *)wrap_WebPEncodeBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically); + SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1); + { + jint jvalue = (jint)temp4; + (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue); + } + free(arg1); + + + + free(result); + return jresult; +} + + +SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) { + jbyteArray jresult = 0 ; + uint8_t *arg1 = (uint8_t *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int arg6 ; + int arg7 ; + float arg8 ; + jbyte *jarr1 ; + int temp4 ; + uint8_t *result = 0 ; + + (void)jenv; + (void)jcls; + if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0; + arg2 = (int *)&jarg2; + arg3 = (int *)&jarg3; + { + if (!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); + return 0; + } + if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return 0; + } + arg4 = &temp4; + } + arg5 = (int)jarg5; + arg6 = (int)jarg6; + arg7 = (int)jarg7; + arg8 = (float)jarg8; + result = (uint8_t *)wrap_WebPEncodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically); + SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1); + { + jint jvalue = (jint)temp4; + (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue); + } + free(arg1); + + + + free(result); + return jresult; +} + + +SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) { + jbyteArray jresult = 0 ; + uint8_t *arg1 = (uint8_t *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int arg6 ; + int arg7 ; + float arg8 ; + jbyte *jarr1 ; + int temp4 ; + uint8_t *result = 0 ; + + (void)jenv; + (void)jcls; + if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0; + arg2 = (int *)&jarg2; + arg3 = (int *)&jarg3; + { + if (!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); + return 0; + } + if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return 0; + } + arg4 = &temp4; + } + arg5 = (int)jarg5; + arg6 = (int)jarg6; + arg7 = (int)jarg7; + arg8 = (float)jarg8; + result = (uint8_t *)wrap_WebPEncodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically); + SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1); + { + jint jvalue = (jint)temp4; + (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue); + } + free(arg1); + + + + free(result); + return jresult; +} + + SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetDecoderVersion(JNIEnv *jenv, jclass jcls) { jint jresult = 0 ; int result; @@ -1178,78 +1448,6 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNI } -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_MODE_1RGB_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - WEBP_CSP_MODE result; - - (void)jenv; - (void)jcls; - result = (WEBP_CSP_MODE)MODE_RGB; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_MODE_1RGBA_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - WEBP_CSP_MODE result; - - (void)jenv; - (void)jcls; - result = (WEBP_CSP_MODE)MODE_RGBA; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_MODE_1BGR_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - WEBP_CSP_MODE result; - - (void)jenv; - (void)jcls; - result = (WEBP_CSP_MODE)MODE_BGR; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_MODE_1BGRA_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - WEBP_CSP_MODE result; - - (void)jenv; - (void)jcls; - result = (WEBP_CSP_MODE)MODE_BGRA; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_MODE_1YUV_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - WEBP_CSP_MODE result; - - (void)jenv; - (void)jcls; - result = (WEBP_CSP_MODE)MODE_YUV; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_VP8_1STATUS_1OK_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - VP8StatusCode result; - - (void)jenv; - (void)jcls; - result = (VP8StatusCode)VP8_STATUS_OK; - jresult = (jint)result; - return jresult; -} - - #ifdef __cplusplus } #endif