Class: Toybox::WatchUi::Bitmap

Inherits:
Drawable show all

Overview

Bitmap is the class representation of a bitmap resource.

A Bitmap can be constructed using the resource compiler and loaded through the resource (Rez) module.

Examples:

// The bitmap.xml file contents:
// <resources>
//     <bitmap id="myBitmap" filename="images/myBitmap.png" />
// </resources>

using Toybox.Graphics;
using Toybox.WatchUi;

class MyWatchView extends WatchUi.View {

    var myBitmap;

    function initialize() {
        View.initialize();
        myBitmap = new WatchUi.Bitmap({
            :rezId=>Rez.Drawables.myBitmap,
            :locX=>10,
            :locY=>30
        });
    }

    // Update the view
    function onUpdate(dc) {
        myBitmap.draw(dc);
    }
}

See Also:

Since:

  • 1.0.0

Instance Attribute Summary

Attributes inherited from Drawable

height, identifier, locX, locY, width

Instance Method Summary collapse

Methods inherited from Drawable

setLocation, setSize

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(settings) ⇒ Bitmap

Returns a new instance of Bitmap

Parameters:

Options Hash (settings):

See Also:

Since:

  • 1.0.0


14229
14230
# File 'Monkeybrains.rb', line 14229

def initialize(settings)
end

Instance Method Details

draw(dc) ⇒ Object

Draw a Bitmap to the device context (Dc).

Parameters:

Since:

  • 1.0.0


14242
14243
# File 'Monkeybrains.rb', line 14242

def draw(dc)
end

getDimensionsToybox::Lang::Array

Get the dimensions of a Bitmap.

Returns:

  • (Toybox::Lang::Array)

    A two element array containing the width and height of the Bitmap object

Since:

  • 1.0.0


14236
14237
# File 'Monkeybrains.rb', line 14236

def getDimensions()
end

setBitmap(identifier) ⇒ Object

Set the resource associated with the Bitmap.

Parameters:

Since:

  • 1.0.0


14249
14250
# File 'Monkeybrains.rb', line 14249

def setBitmap(identifier)
end