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.

use Watch Face Format instead

Summary

Nested types

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public fields

static final @NonNull RenderParameters

This field is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public constructors

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

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public methods

boolean
equals(Object other)

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final @NonNull DrawMode

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final RenderParameters.HighlightLayer

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

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

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final @NonNull Set<@NonNull WatchFaceLayer>

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

int

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

final boolean

This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public fields

DEFAULT_INTERACTIVE

public static final @NonNull RenderParameters DEFAULT_INTERACTIVE

Default RenderParameters which draws everything in interactive mode.

Public constructors

RenderParameters

public RenderParameters(
    @NonNull DrawMode drawMode,
    @NonNull Set<@NonNull WatchFaceLayer> watchFaceLayers,
    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.

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

public boolean equals(Object other)

getDrawMode

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull DrawMode getDrawMode()

The overall drawing parameters based on system state.

getHighlightLayer

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final RenderParameters.HighlightLayer getHighlightLayer()

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.

getLastComplicationTapDownEvents

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull Map<@NonNull Integer, @NonNull TapEventgetLastComplicationTapDownEvents()

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

getWatchFaceLayers

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull Set<@NonNull WatchFaceLayergetWatchFaceLayers()

The parts of the watch face to draw.

hashCode

public int hashCode()

isForScreenshot

Added in 1.1.0
Deprecated in 1.3.0-alpha06
public final boolean isForScreenshot()

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.