39 private static final class CppProxy
extends Image
41 private final long nativeRef;
42 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
44 private CppProxy(
long nativeRef)
46 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
47 this.nativeRef = nativeRef;
50 private native
void nativeDestroy(
long nativeRef);
51 public void _djinni_private_destroy()
53 boolean destroyed = this.destroyed.getAndSet(
true);
54 if (!destroyed) nativeDestroy(this.nativeRef);
56 protected void finalize() throws
java.lang.Throwable
58 _djinni_private_destroy();
65 public byte[] getData()
67 assert !this.destroyed.get() :
"trying to use a destroyed object";
68 return native_getData(this.nativeRef);
70 private native
byte[] native_getData(
long _nativeRef);
75 assert !this.destroyed.get() :
"trying to use a destroyed object";
76 return native_getWidth(this.nativeRef);
78 private native
int native_getWidth(
long _nativeRef);
81 public int getHeight()
83 assert !this.destroyed.get() :
"trying to use a destroyed object";
84 return native_getHeight(this.nativeRef);
86 private native
int native_getHeight(
long _nativeRef);
89 public ImageType getType()
91 assert !this.destroyed.get() :
"trying to use a destroyed object";
92 return native_getType(this.nativeRef);
94 private native ImageType native_getType(
long _nativeRef);