diff --git a/README b/README index 37cab537..34e24124 100644 --- a/README +++ b/README @@ -82,12 +82,13 @@ 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 following functions are mapped: +Currently the following functions are mapped: Decode: WebPGetDecoderVersion WebPGetInfo WebPDecodeRGB WebPDecodeRGBA + WebPDecodeARGB WebPDecodeBGR WebPDecodeBGRA Encode: diff --git a/swig/libwebp.i b/swig/libwebp.i index 2c6102f3..74cd7251 100644 --- a/swig/libwebp.i +++ b/swig/libwebp.i @@ -42,6 +42,7 @@ // the native type %newobject WebPDecodeRGB; %newobject WebPDecodeRGBA; +%newobject WebPDecodeARGB; %newobject WebPDecodeBGR; %newobject WebPDecodeBGRA; %typemap(newfree) uint8_t* "free($1);" @@ -54,6 +55,8 @@ uint8_t* WebPDecodeRGB(const uint8_t* data, uint32_t data_size, int *width, int *height); uint8_t* WebPDecodeRGBA(const uint8_t* data, uint32_t data_size, int *width, int *height); +uint8_t* WebPDecodeARGB(const uint8_t* data, uint32_t data_size, + int* width, int* height); uint8_t* WebPDecodeBGR(const uint8_t* data, uint32_t data_size, int *width, int *height); uint8_t* WebPDecodeBGRA(const uint8_t* data, uint32_t data_size, @@ -82,6 +85,7 @@ static jint returned_buffer_size( } size_map[] = { { "Java_com_google_webp_libwebpJNI_WebPDecodeRGB", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 }, + { "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 }, { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 }, diff --git a/swig/libwebp.jar b/swig/libwebp.jar index b435e25e..238995db 100644 Binary files a/swig/libwebp.jar and b/swig/libwebp.jar differ diff --git a/swig/libwebp_java_wrap.c b/swig/libwebp_java_wrap.c index f4dc95a8..c653ec06 100644 --- a/swig/libwebp_java_wrap.c +++ b/swig/libwebp_java_wrap.c @@ -822,6 +822,7 @@ static jint returned_buffer_size( } size_map[] = { { "Java_com_google_webp_libwebpJNI_WebPDecodeRGB", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 }, + { "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 }, { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 }, { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 }, @@ -1110,6 +1111,69 @@ SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNI } +SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) { + jbyteArray jresult = 0 ; + uint8_t *arg1 = (uint8_t *) 0 ; + uint32_t arg2 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + jbyte *jarr1 ; + int temp3 ; + int temp4 ; + uint8_t *result = 0 ; + + (void)jenv; + (void)jcls; + if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0; + arg2 = (uint32_t)jarg2; + { + if (!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); + return 0; + } + if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return 0; + } + arg3 = &temp3; + } + { + 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; + } + { + if (arg2 < 0) { + { + SWIG_JavaException(jenv, SWIG_ValueError, "Expected a non-negative value."); return 0; + }; + } + } + result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4); + jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically); + SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1); + { + jint jvalue = (jint)temp3; + (*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue); + } + { + 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_WebPDecodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jintArray jarg3, jintArray jarg4) { jbyteArray jresult = 0 ; uint8_t *arg1 = (uint8_t *) 0 ;