readme: add information section
[nit.git] / lib / android / assets_and_resources.nit
index 897938a..8bbc7da 100644 (file)
@@ -218,8 +218,7 @@ class ResourcesManager
 
        private init native(res: NativeResources, app_package: String)
        do
-               self.android_resources = res.new_global_ref
-               self.app_package = app_package
+               init(res.new_global_ref, app_package)
        end
 
        # Get a color from resources
@@ -304,9 +303,31 @@ private extern class NativeBitmap in "Java" `{ android.graphics.Bitmap `}
        # 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();
+       `}
+
        # HACK for bug #845
        redef fun new_global_ref import sys, Sys.jni_env `{
                Sys sys = NativeBitmap_sys(self);
@@ -314,6 +335,9 @@ private extern class NativeBitmap in "Java" `{ android.graphics.Bitmap `}
                return (*env)->NewGlobalRef(env, self);
        `}
 
+       redef fun pop_from_local_frame_with_env(jni_env) `{
+               return (*jni_env)->PopLocalFrame(jni_env, self);
+       `}
 end
 
 # Android AssetFileDescriptor, can be retrieve by AssetManager and used to load a sound in a SoundPool