Bitmap(native)
Bitmap class manages all operations with pictures. Using this class developer can load images from files and get theirs size, configuration etc.
Example
function loadImage() { // load bitmap file into memory this.bitmap = Bitmap.fromFile("dat://moscrif.jpg"); } ... // draw bitmap inside onDrawFunction app.onDraw = function(sender, canvas) { canvas.drawBitmap(this.bitmap, 0, 0); // there are also other functions for bitmap drawing see canvas class }
Properties
-
config : Integer
Returns a number representating bitmap's configuration.
-
height : Integer
Height of loaded image.
-
opaque : Integer
Is true if the device's bitmap config treats every pixel as implicitly opaque.
-
width : Integer
Width of loaded image.
Methods
-
fromBytes(data) : Bitmap
Loads image from byte array.
-
fromFile(file) : Bitmap
Function loads image from file. Supported types are: JPG and PNG.
-
getSize(file) : Multivalue
Returns size of image file in pixels.
-
reset() : Bitmap
Reset all values in object, included loaded image, height and width.
-
resize(param1,param2) : Bitmap
Resizes bitmap according to required width and height.
- .jpg - format uses lossy compression but does not support alpha channel. Frequently used for digital photography.
-
- .png - bitmap format of image that employs lossless data compression. This format also support alpha channel.