1 #include <com.badlogic.gdx.graphics.glutils.ETC1.h> 2 3 //@line:196 4 5 #include <etc1/etc1_utils.h> 6 #include <stdlib.h> 7 JNIEXPORT jint JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_getCompressedDataSize(JNIEnv* env, jclass clazz, jint width, jint height) { 8 9 10 //@line:204 11 12 return etc1_get_encoded_data_size(width, height); 13 14 15 } 16 17 JNIEXPORT void JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_formatHeader(JNIEnv* env, jclass clazz, jobject obj_header, jint offset, jint width, jint height) { 18 char* header = (char*)(obj_header?env->GetDirectBufferAddress(obj_header):0); 19 20 21 //@line:214 22 23 etc1_pkm_format_header((etc1_byte*)header + offset, width, height); 24 25 26 } 27 28 static inline jint wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_getWidthPKM 29 (JNIEnv* env, jclass clazz, jobject obj_header, jint offset, char* header) { 30 31 //@line:221 32 33 return etc1_pkm_get_width((etc1_byte*)header + offset); 34 35 } 36 37 JNIEXPORT jint JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_getWidthPKM(JNIEnv* env, jclass clazz, jobject obj_header, jint offset) { 38 char* header = (char*)(obj_header?env->GetDirectBufferAddress(obj_header):0); 39 40 jint JNI_returnValue = wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_getWidthPKM(env, clazz, obj_header, offset, header); 41 42 43 return JNI_returnValue; 44 } 45 46 static inline jint wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_getHeightPKM 47 (JNIEnv* env, jclass clazz, jobject obj_header, jint offset, char* header) { 48 49 //@line:228 50 51 return etc1_pkm_get_height((etc1_byte*)header + offset); 52 53 } 54 55 JNIEXPORT jint JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_getHeightPKM(JNIEnv* env, jclass clazz, jobject obj_header, jint offset) { 56 char* header = (char*)(obj_header?env->GetDirectBufferAddress(obj_header):0); 57 58 jint JNI_returnValue = wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_getHeightPKM(env, clazz, obj_header, offset, header); 59 60 61 return JNI_returnValue; 62 } 63 64 static inline jboolean wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_isValidPKM 65 (JNIEnv* env, jclass clazz, jobject obj_header, jint offset, char* header) { 66 67 //@line:235 68 69 return etc1_pkm_is_valid((etc1_byte*)header + offset) != 0?true:false; 70 71 } 72 73 JNIEXPORT jboolean JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_isValidPKM(JNIEnv* env, jclass clazz, jobject obj_header, jint offset) { 74 char* header = (char*)(obj_header?env->GetDirectBufferAddress(obj_header):0); 75 76 jboolean JNI_returnValue = wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_isValidPKM(env, clazz, obj_header, offset, header); 77 78 79 return JNI_returnValue; 80 } 81 82 JNIEXPORT void JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_decodeImage(JNIEnv* env, jclass clazz, jobject obj_compressedData, jint offset, jobject obj_decodedData, jint offsetDec, jint width, jint height, jint pixelSize) { 83 char* compressedData = (char*)(obj_compressedData?env->GetDirectBufferAddress(obj_compressedData):0); 84 char* decodedData = (char*)(obj_decodedData?env->GetDirectBufferAddress(obj_decodedData):0); 85 86 87 //@line:249 88 89 etc1_decode_image((etc1_byte*)compressedData + offset, (etc1_byte*)decodedData + offsetDec, width, height, pixelSize, width * pixelSize); 90 91 92 } 93 94 static inline jobject wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImage 95 (JNIEnv* env, jclass clazz, jobject obj_imageData, jint offset, jint width, jint height, jint pixelSize, char* imageData) { 96 97 //@line:260 98 99 int compressedSize = etc1_get_encoded_data_size(width, height); 100 etc1_byte* compressedData = (etc1_byte*)malloc(compressedSize); 101 etc1_encode_image((etc1_byte*)imageData + offset, width, height, pixelSize, width * pixelSize, compressedData); 102 return env->NewDirectByteBuffer(compressedData, compressedSize); 103 104 } 105 106 JNIEXPORT jobject JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImage(JNIEnv* env, jclass clazz, jobject obj_imageData, jint offset, jint width, jint height, jint pixelSize) { 107 char* imageData = (char*)(obj_imageData?env->GetDirectBufferAddress(obj_imageData):0); 108 109 jobject JNI_returnValue = wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImage(env, clazz, obj_imageData, offset, width, height, pixelSize, imageData); 110 111 112 return JNI_returnValue; 113 } 114 115 static inline jobject wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImagePKM 116 (JNIEnv* env, jclass clazz, jobject obj_imageData, jint offset, jint width, jint height, jint pixelSize, char* imageData) { 117 118 //@line:274 119 120 int compressedSize = etc1_get_encoded_data_size(width, height); 121 etc1_byte* compressed = (etc1_byte*)malloc(compressedSize + ETC_PKM_HEADER_SIZE); 122 etc1_pkm_format_header(compressed, width, height); 123 etc1_encode_image((etc1_byte*)imageData + offset, width, height, pixelSize, width * pixelSize, compressed + ETC_PKM_HEADER_SIZE); 124 return env->NewDirectByteBuffer(compressed, compressedSize + ETC_PKM_HEADER_SIZE); 125 126 } 127 128 JNIEXPORT jobject JNICALL Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImagePKM(JNIEnv* env, jclass clazz, jobject obj_imageData, jint offset, jint width, jint height, jint pixelSize) { 129 char* imageData = (char*)(obj_imageData?env->GetDirectBufferAddress(obj_imageData):0); 130 131 jobject JNI_returnValue = wrapped_Java_com_badlogic_gdx_graphics_glutils_ETC1_encodeImagePKM(env, clazz, obj_imageData, offset, width, height, pixelSize, imageData); 132 133 134 return JNI_returnValue; 135 } 136 137