RenderParameters


class RenderParameters


Used to parameterize watch face rendering.

Watch face rendering is split up in a number of layers: the base layer WatchFaceLayer.BASE, the ComplicationSlots layer WatchFaceLayer.COMPLICATIONS, and the layer above the complicationSlots WatchFaceLayer.COMPLICATIONS_OVERLAY. These layers are always drawn in this order, one on top of the previous one. These are the layers that are used to render the watch face itself.

An additional layer, the highlight layer, can be drawn during editing the watch face to highlight different elements of the watch face, namely a set of ComplicationSlots (which may be a single ComplicationSlot) or the area of the watch face that is affected by a single user style setting.

The watch face should provide a way to highlight any of the above combinations so that its own editor, or the one provided by the Wear OS companion phone app is able to highlight the editable part of the watch face to the user. If an individual user style setting is meant to affect the entire watch face (e.g. an overall color setting),then the entire watch face should be highlighted.

The watch face layers and highlight layer can be configured independently, so that it is possible to draw only the highlight layer by passing an empty set of watchFaceLayers.

The semantics of rendering different layers is such that if each individual layer is rendered independently and the resulting images are composited with alpha blending, the result is identical to rendering all of the layers in a single request.

Summary

Public companion properties

RenderParameters

Default RenderParameters which draws everything in interactive mode.

Public constructors

RenderParameters(
    drawMode: DrawMode,
    watchFaceLayers: Set<WatchFaceLayer>,
    highlightLayer: RenderParameters.HighlightLayer?,
    lastComplicationTapDownEvents: Map<IntTapEvent>
)

Public functions

open operator Boolean
equals(other: Any?)
open Int

Public properties

DrawMode

The overall drawing parameters based on system state.

RenderParameters.HighlightLayer?

Optional HighlightLayer used by editors to visually highlight an aspect of the watch face.

Boolean

Whether or not we're rendering for a screenshot.

Map<IntTapEvent>

Map of ComplicationSlot id to the latest TapType.DOWN that ComplicationSlot received, if any.

Set<WatchFaceLayer>

The parts of the watch face to draw.

Public companion properties

DEFAULT_INTERACTIVE

val DEFAULT_INTERACTIVERenderParameters

Default RenderParameters which draws everything in interactive mode.

Public constructors

RenderParameters

RenderParameters(
    drawMode: DrawMode,
    watchFaceLayers: Set<WatchFaceLayer>,
    highlightLayer: RenderParameters.HighlightLayer? = null,
    lastComplicationTapDownEvents: Map<IntTapEvent> = emptyMap()
)
Parameters
drawMode: DrawMode

The overall drawing parameters based on system state.

watchFaceLayers: Set<WatchFaceLayer>

The parts of the watch face to draw.

highlightLayer: RenderParameters.HighlightLayer? = null

Optional HighlightLayer used by editors to visually highlight an aspect of the watch face. Rendered last on top of watchFaceLayers. If highlighting isn't needed this will be null.

lastComplicationTapDownEvents: Map<IntTapEvent> = emptyMap()

Map of ComplicationSlot id to the latest TapType.DOWN that ComplicationSlot received, if any.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

drawMode

Added in 1.0.0
val drawModeDrawMode

The overall drawing parameters based on system state.

highlightLayer

Added in 1.0.0
val highlightLayerRenderParameters.HighlightLayer?

Optional HighlightLayer used by editors to visually highlight an aspect of the watch face. Rendered last on top of watchFaceLayers. If highlighting isn't needed this will be null.

isForScreenshot

Added in 1.1.0
val isForScreenshotBoolean

Whether or not we're rendering for a screenshot. Some watch faces with animations may need to make adjustments when a screen shot is taken to achieve the best result.

Note Renderer.CanvasRenderer2 and Renderer.CanvasRenderer always use software rendering for screenshots.

lastComplicationTapDownEvents

Added in 1.0.0
val lastComplicationTapDownEventsMap<IntTapEvent>

Map of ComplicationSlot id to the latest TapType.DOWN that ComplicationSlot received, if any.

watchFaceLayers

Added in 1.0.0
val watchFaceLayersSet<WatchFaceLayer>

The parts of the watch face to draw.