Developer   API   Graphics   Bitmap

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.

Remarks

Bitmap class supports following formats:

  • .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.

API Navigation
Skip Navigation Links.
Expand <span>User Interface</span> User Interface
Expand <span>Core & System</span> Core & System
Collapse <span>Graphics</span> Graphics
Canvas
Paint
Bitmap
Typeface
Path
Matrix
Shader
ColorFilter
MaskFilter
Expand <span>Files and Databases</span> Files and Databases
Expand <span>Crypto</span> Crypto
Expand <span>Native User Interface</span> Native User Interface
Expand <span>Net</span> Net
Expand <span>Media</span> Media
Expand <span>Sensor</span> Sensor
Expand <span>Game Development</span> Game Development