RenderParameters

public final 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

Nested types

RenderParameters.Companion
RenderParameters.HighlightLayer

The definition of what to include in the highlight layer.

RenderParameters.HighlightedElement

An element of the watch face to highlight.

RenderParameters.HighlightedElement.AllComplicationSlots

All ComplicationSlots will be highlighted.

RenderParameters.HighlightedElement.ComplicationSlot

A single androidx.wear.watchface.ComplicationSlot with the specified id will be highlighted.

RenderParameters.HighlightedElement.UserStyle

A UserStyleSetting to highlight.

Public fields

final @NonNull DrawMode

The overall drawing parameters based on system state.

final @Nullable RenderParameters.HighlightLayer

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

final @NonNull Map<@NonNull Integer, @NonNull TapEvent>

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

final @NonNull Set<@NonNull WatchFaceLayer>

The parts of the watch face to draw.

Public constructors

RenderParameters(
    @NonNull DrawMode drawMode,
    @NonNull Set<@NonNull WatchFaceLayer> watchFaceLayers,
    @Nullable RenderParameters.HighlightLayer highlightLayer,
    @NonNull Map<@NonNull Integer, @NonNull TapEvent> lastComplicationTapDownEvents
)

Public methods

boolean
int

Public fields

drawMode

@NonNull
public final @NonNull DrawMode drawMode

The overall drawing parameters based on system state.

highlightLayer

@Nullable
public final @Nullable RenderParameters.HighlightLayer 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.

lastComplicationTapDownEvents

@NonNull
public final @NonNull Map<@NonNull Integer, @NonNull TapEventlastComplicationTapDownEvents

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

watchFaceLayers

@NonNull
public final @NonNull Set<@NonNull WatchFaceLayerwatchFaceLayers

The parts of the watch face to draw.

Public constructors

RenderParameters

public final RenderParameters(
    @NonNull DrawMode drawMode,
    @NonNull Set<@NonNull WatchFaceLayer> watchFaceLayers,
    @Nullable RenderParameters.HighlightLayer highlightLayer,
    @NonNull Map<@NonNull Integer, @NonNull TapEvent> lastComplicationTapDownEvents
)
Parameters
@NonNull DrawMode drawMode

The overall drawing parameters based on system state.

@NonNull Set<@NonNull WatchFaceLayer> watchFaceLayers

The parts of the watch face to draw.

@Nullable RenderParameters.HighlightLayer 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.

@NonNull Map<@NonNull Integer, @NonNull TapEvent> lastComplicationTapDownEvents

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

Public methods

equals

@NonNull
public boolean equals(@Nullable Object other)

hashCode

@NonNull
public int hashCode()