implement BitmapFactory.decodeStream() using gdk_pixbuf_new_from_stream

The java InputStream is wrapped into a custom GInputStream
implementation
This commit is contained in:
Julian Winkler
2023-09-01 13:09:04 +02:00
parent 30b990f60a
commit ceb5df9d39
7 changed files with 95 additions and 8 deletions

View File

@@ -52,3 +52,15 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeRecycle(JNIEnv *en
g_object_unref(pixbuf);
return true;
}
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1copy(JNIEnv *env, jclass, jlong src_ptr) {
GdkPixbuf *src = _PTR(src_ptr);
GdkPixbuf *copy = gdk_pixbuf_copy(src);
return _INTPTR(copy);
}
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeRowBytes(JNIEnv *env, jclass, jlong pixbuf_ptr) {
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
return gdk_pixbuf_get_rowstride(pixbuf);
}