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 |
|---|
public final class RenderParameters.HighlightLayerThis class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
public sealed class RenderParameters.HighlightedElementThis class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
public static class RenderParameters.HighlightedElement.AllComplicationSlots extends RenderParameters.HighlightedElementThis class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
public final class RenderParameters.HighlightedElement.ComplicationSlot extends RenderParameters.HighlightedElementThis class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
public final class RenderParameters.HighlightedElement.UserStyle extends RenderParameters.HighlightedElementThis 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 |
|---|
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
boolean |
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
publicRenderParameters(
@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 |
@NonNull Map<@NonNull Integer, @NonNull TapEvent> lastComplicationTapDownEvents |
Map of |
Public methods
getDrawMode
public final @NonNull DrawModegetDrawMode()
The overall drawing parameters based on system state.
getHighlightLayer
public final RenderParameters.HighlightLayergetHighlightLayer()
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
public final @NonNull Map<@NonNull Integer, @NonNull TapEvent>getLastComplicationTapDownEvents()
Map of ComplicationSlot id to the latest TapType.DOWN that ComplicationSlot received, if any.
getWatchFaceLayers
public final @NonNull Set<@NonNull WatchFaceLayer>getWatchFaceLayers()
The parts of the watch face to draw.
isForScreenshot
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.