From d646d5c74387c5e5cff5c9b2feec4da43d29bfaf Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 14 Jul 2011 17:35:40 -0700 Subject: [PATCH] swig: add WebPDecodeARGB Change-Id: I6f22cf0f87a7274f2ed63e4aa96267a8155a5e35 --- README | 3 +- swig/libwebp.i | 4 +++ swig/libwebp.jar | Bin 1917 -> 1938 bytes swig/libwebp_java_wrap.c | 64 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) 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 b435e25ebc2902252348f68e4246f291aaffa873..238995db04997a459227d6ca0b067e7f267b95e8 100644 GIT binary patch delta 1239 zcmey%H;JD&z?+#xgn{hDWB}hXkEYU&KizfQI`d4r*L(3Dcz9XdZeLg!7}+X+t#Ic z-c(K1?%aQpKhDmh=Og=%#XZk;v~M*ooBL$$xjD~m)6>eHU4Q@Ho>6DPqDMmSR_^Fm zoyM-iA2}^jZsVE_Yc|=Wo!s~&l1t}k9M9qYg3(%`~LmF%kHn7w~Zrw z`J*q<#o`LVdA$!mU%T`3=H*X`E1P!z+<)_M(4&qy#!Ab%b+1d`6A#?}Hf(d=nwd5K zq7JW-mEL-IXYJp;>lE861pG~64)18=jJa;mDJ``uVp(Kb#3UU}w@W)#CQeg5Y;@eH z%dm0cuG$HAH^1H6RzLCSpUCxn2N=RnnU!Sg?~c4}{;Kal1bap8VyAA2W!!vU5_ke* z*p`;Lhc75n{blb`ye01vORvxs?pJ?b<_paKS@lRO^T6CU&ieUhogcrGSukh8^TjT0 zolE{!Kd}(Wa?p^SeRj?P^~=pJmmOn$wCAf>d3^~{zomb9v5SBCB4(rdxe8Uwgk`6^ z-0KRt45u?%5{>Teyn`&uYF3~CF$c44q3PTIa(7k_jPAF zn5~_hxv)Dkz|2{)SiZ{P>ZLqdTKc9YSFXNY>De|wf=jVUcR{EqIr5Ias|G`~* zP|D4)j#v}x{6;0WA zrD8T1rrxZjHJ&mGh2e`@=g-z@xOQ%e~q_p~a=ESezG8a|~1h0)a5cJRf=UPAgv;~{D?zx#N zu|Kj>&T_K5rk+UXT7})g#ZtMYjsNwoF5WaNYpt93+g@wKZkv1Gp2lmj?X!OV?#Zfb z`TjZK>g_5)Jf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) == 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 ;