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

@@ -136,7 +136,13 @@ public final class Bitmap {
mLayoutBounds = null;
}
Bitmap(long pixbuf) {
this();
this.pixbuf = pixbuf;
}
private native long native_bitmap_from_path(CharSequence path);
static native long native_copy(long src);
/**
* Private constructor that must received an already allocated native bitmap
@@ -784,7 +790,7 @@ public final class Bitmap {
return bitmap;
*/
return new Bitmap();
return new Bitmap(native_copy(source.pixbuf));
}
/**
@@ -1606,7 +1612,7 @@ public final class Bitmap {
int quality, OutputStream stream,
byte[] tempStorage);
private static native void nativeErase(int nativeBitmap, int color);
private static native int nativeRowBytes(int nativeBitmap);
private static native int nativeRowBytes(long nativeBitmap);
private static native int nativeConfig(int nativeBitmap);
private static native int nativeGetPixel(int nativeBitmap, int x, int y,