Class: $.AnalogView

Inherits:
WatchUi.WatchFace show all

Overview

This implements an analog watch face Original design by Austen Harbour

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var _dateBuffer as Graphics.BufferedBitmap or Null

var _dndIcon as WatchUi.BitmapResource or Null

var _font as WatchUi.FontResource or Null

var _fullScreenRefresh as Lang.Boolean

var _isAwake as Lang.Boolean or Null

var _offscreenBuffer as Graphics.BufferedBitmap or Null

var _partialUpdatesAllowed as Lang.Boolean

var _screenCenterPoint as Lang.Array<Lang.Number> or Null

var _screenShape as System.ScreenShape

Instance Method Details

drawBackground(dc as Graphics.Dc) as Void

Draw the watch face background onUpdate uses this method to transfer newly rendered Buffered Bitmaps to the main display. onPartialUpdate uses this to blank the second hand from the previous second before outputting the new one.

Parameters:

  • dc —

    Device context

drawDateString(dc as Graphics.Dc, x as Lang.Number, y as Lang.Number) as Void

Draw the date string into the provided buffer at the specified location

Parameters:

  • dc —

    Device context

  • x —

    The x location of the text

  • y —

    The y location of the text

drawHashMarks(dc as Graphics.Dc) as Void

Draws the clock tick marks around the outside edges of the screen.

Parameters:

  • dc —

    Device context

generateHandCoordinates(centerPoint as Lang.Array<Lang.Number>, angle as Lang.Float, handLength as Lang.Number, tailLength as Lang.Number, width as Lang.Number) as Lang.Array<[ Lang.Numeric, Lang.Numeric ]>

This function is used to generate the coordinates of the 4 corners of the polygon used to draw a watch hand. The coordinates are generated with specified length, tail length, and width and rotated around the center point at the provided angle. 0 degrees is at the 12 o'clock position, and increases in the clockwise direction.

Parameters:

  • centerPoint —

    The center of the clock

  • angle —

    Angle of the hand in radians

  • handLength —

    The length of the hand from the center to point

  • tailLength —

    The length of the tail of the hand

  • width —

    The width of the watch hand

Returns:

  • The coordinates of the watch hand

getBoundingBox(points as Lang.Array<[ Lang.Numeric, Lang.Numeric ]>) as Lang.Array<[ Lang.Numeric, Lang.Numeric ]>

Compute a bounding box from the passed in points

Parameters:

  • points —

    Points to include in bounding box

Returns:

  • The bounding box points

initialize()

Initialize variables for this view

onEnterSleep() as Void

This method is called when the device re-enters sleep mode. Set the isAwake flag to let onUpdate know it should stop rendering the second hand.

onExitSleep() as Void

This method is called when the device exits sleep mode. Set the isAwake flag to let onUpdate know it should render the second hand.

onLayout(dc as Graphics.Dc) as Void

Configure the layout of the watchface for this device

Parameters:

  • dc —

    Device context

onPartialUpdate(dc as Graphics.Dc) as Void

Handle the partial update event

Parameters:

  • dc —

    Device context

onUpdate(dc as Graphics.Dc) as Void

Handle the update event

Parameters:

  • dc —

    Device context

turnPartialUpdatesOff() as Void

Turn off partial updates


Generated Jun 9, 2026, 8:45:30 AM