105 private final long nativeRef;
106 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
108 private CppProxy(
long nativeRef)
110 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
111 this.nativeRef = nativeRef;
114 private native
void nativeDestroy(
long nativeRef);
115 public void _djinni_private_destroy()
117 boolean destroyed = this.destroyed.getAndSet(
true);
118 if (!destroyed) nativeDestroy(this.nativeRef);
120 protected void finalize() throws java.lang.Throwable
122 _djinni_private_destroy();
129 public android.graphics.Bitmap decodeRegion(
Rectangle rect,
float sampleSize)
131 assert !this.destroyed.get() :
"trying to use a destroyed object";
132 return native_decodeRegion(this.nativeRef, rect, sampleSize);
134 private native android.graphics.Bitmap native_decodeRegion(
long _nativeRef,
Rectangle rect,
float sampleSize);
137 public int getWidth()
139 assert !this.destroyed.get() :
"trying to use a destroyed object";
140 return native_getWidth(this.nativeRef);
142 private native
int native_getWidth(
long _nativeRef);
145 public int getHeight()
147 assert !this.destroyed.get() :
"trying to use a destroyed object";
148 return native_getHeight(this.nativeRef);
150 private native
int native_getHeight(
long _nativeRef);
152 public static native BitmapRegionDecoder newInstance(
byte[] data);
154 public static native BitmapRegionDecoder newInstanceFromImage(Image data);