android :: NativeBitmap :: defaultinit
# An android Bitmap, get an instance using the AssetManager or the ResourceManager
private extern class NativeBitmap in "Java" `{ android.graphics.Bitmap `}
super JavaObject
# Create a NativeBitmap from a NativeInputStream retrieved with `open` function of the AssetManager
# Called by the AssetManager
new from_stream(input_stream: NativeInputStream) in "Java" `{ return BitmapFactory.decodeStream(input_stream); `}
# Create a NativeBitmap using a resource ID and the NativeResources
# Called by the ResourceManager
new from_resources(res: NativeResources, id: Int) in "Java" `{ return BitmapFactory.decodeResource(res, (int)id); `}
# Width in pixels
#
# Wraps Java: `int android.graphics.Bitmap.getWidth()`
fun width: Int in "Java" `{ return self.getWidth(); `}
# Height in pixels
#
# Wraps Java: `int android.graphics.Bitmap.getHeight()`
fun height: Int in "Java" `{ return self.getHeight(); `}
# Number of bytes per row
#
# Wraps Java: `int android.graphics.Bitmap.getRowBytes()`
fun row_bytes: Int in "Java" `{
return self.getRowBytes();
`}
# Does this bitmap has an alpha channel?
#
# Wraps Java: `boolean android.graphics.Bitmap.hasAlpha()`
fun has_alpha: Bool in "Java" `{
return self.hasAlpha();
`}
fun recycle in "Java" `{
self.recycle();
`}
# HACK for bug #845
redef fun new_global_ref import sys, Sys.jni_env `{
Sys sys = NativeBitmap_sys(self);
JNIEnv *env = Sys_jni_env(sys);
return (*env)->NewGlobalRef(env, self);
`}
redef fun pop_from_local_frame_with_env(jni_env) `{
return (*jni_env)->PopLocalFrame(jni_env, self);
`}
end
lib/android/assets_and_resources.nit:294,1--344,3