Module: Toybox::Graphics

Overview

The Graphics module provides a set of tools that allow developers to use basic drawing functionality.

This provides the ability to draw shapes, lines, fill shapes, and use dynamic layouts for graphic elements based on specific device contexts. The Device Context (Dc) is useful for developers who are interested in creating content for multiple device platforms with differing screen shapes, sizes, and color palettes.

Since:

  • 1.0.0

App Types:

  • Watch Face

  • Data Field

  • Widget

  • App

  • Audio Content Provider App

Defined Under Namespace

Classes: BufferedBitmap, Dc, InvalidBitmapResourceException, InvalidPaletteException

Constant Summary

FONT_XTINY = 0

Extra tiny Connect IQ font

Since:

  • 1.0.0

FONT_TINY = 1

Tiny Connect IQ font

Since:

  • 1.0.0

FONT_SMALL = 2

Small Connect IQ font

Since:

  • 1.0.0

FONT_MEDIUM = 3

Medium Connect IQ font

Since:

  • 1.0.0

FONT_LARGE = 4

Large Connect IQ font

Since:

  • 1.0.0

FONT_NUMBER_MILD = 5

Normal size number only Connect IQ font

Since:

  • 1.0.0

FONT_NUMBER_MEDIUM = 6

Medium size number only Connect IQ font

Since:

  • 1.0.0

FONT_NUMBER_HOT = 7

Large size number only Connect IQ font

Since:

  • 1.0.0

FONT_NUMBER_THAI_HOT = 8

Huge size number only Connect IQ font

Since:

  • 1.0.0

FONT_SYSTEM_XTINY = 9

Extra tiny system font

Since:

  • 1.3.0

FONT_SYSTEM_TINY = 10

Tiny system font

Since:

  • 1.3.0

FONT_SYSTEM_SMALL = 11

Small system font

Since:

  • 1.3.0

FONT_SYSTEM_MEDIUM = 12

Medium system font

Since:

  • 1.3.0

FONT_SYSTEM_LARGE = 13

Large system font

Since:

  • 1.3.0

FONT_SYSTEM_NUMBER_MILD = 14

Normal size number only system font

Since:

  • 1.3.0

FONT_SYSTEM_NUMBER_MEDIUM = 15

Medium size number only system font

Since:

  • 1.3.0

FONT_SYSTEM_NUMBER_HOT = 16

Large size number only system font

Since:

  • 1.3.0

FONT_SYSTEM_NUMBER_THAI_HOT = 17

Huge size number only system font

Since:

  • 1.3.0

COLOR_WHITE = 0xFFFFFF

White

Since:

  • 1.0.0

COLOR_LT_GRAY = 0xAAAAAA

Light Gray

Since:

  • 1.0.0

COLOR_DK_GRAY = 0x555555

Dark Gray

Since:

  • 1.0.0

COLOR_BLACK = 0x000000

Black

Since:

  • 1.0.0

COLOR_RED = 0xFF0000

Red

Since:

  • 1.0.0

COLOR_DK_RED = 0xAA0000

Dark Red

Since:

  • 1.0.0

COLOR_ORANGE = 0xFF5500

Orange

Since:

  • 1.0.0

COLOR_YELLOW = 0xFFAA00

Yellow

Since:

  • 1.0.0

COLOR_GREEN = 0x00FF00

Green

Since:

  • 1.0.0

COLOR_DK_GREEN = 0x00AA00

Dark Green

Since:

  • 1.0.0

COLOR_BLUE = 0x00AAFF

Blue

Since:

  • 1.0.0

COLOR_DK_BLUE = 0x0000FF

Dark Blue

Since:

  • 1.0.0

COLOR_PURPLE = 0xAA00FF

Purple. Not valid on fenix 3 or D2 Bravo. Use 0x5500AA instead.

Since:

  • 1.0.0

COLOR_PINK = 0xFF00FF

Pink

Since:

  • 1.0.0

COLOR_TRANSPARENT = -1

Transparent

Since:

  • 1.0.0

TEXT_JUSTIFY_RIGHT = 0

Right justify the text at the x/y coordinates

Since:

  • 1.0.0

TEXT_JUSTIFY_CENTER = 1

Center justify the text at the x/y coordinates

Since:

  • 1.0.0

TEXT_JUSTIFY_LEFT = 2

Left justify the text at the x/y coordinates

Since:

  • 1.0.0

TEXT_JUSTIFY_VCENTER = 4

Center the text vertically

Since:

  • 1.0.0

ARC_COUNTER_CLOCKWISE = 0

Counter clockwise draw

Since:

  • 1.2.0

ARC_CLOCKWISE = 1

Clockwise draw

Since:

  • 1.2.0

Instance Method Summary collapse

Instance Method Details

getFontAscent(font) ⇒ Toybox::Lang::Number

Get the recommended distance above the baseline for single spaced text.

The base line is the line on which the text sits.

Parameters:

Returns:

Since:

  • 1.2.0


4840
4841
# File 'Monkeybrains.rb', line 4840

def getFontAscent(font)
end

getFontDescent(font) ⇒ Toybox::Lang::Number

Get the recommended distance below the baseline for single spaced text.

The base line is the line on which the text sits.

Parameters:

Returns:

Since:

  • 1.2.0


4849
4850
# File 'Monkeybrains.rb', line 4849

def getFontDescent(font)
end

getFontHeight(font) ⇒ Toybox::Lang::Number

Get the height (ascent plus descent) of the given font.

Parameters:

Returns:

Since:

  • 1.2.0


4856
4857
# File 'Monkeybrains.rb', line 4856

def getFontHeight(font)
end