# Renderer

Artifact: [androidx.wear.watchface:watchface](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/Renderer.kt+class:androidx.wear.watchface.Renderer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
public sealed class Renderer
```

<br />

Known direct subclasses [Renderer.CanvasRenderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer), [Renderer.GlesRenderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer)

|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer` | **This class is deprecated.** CanvasRenderer is deprecated |
| `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer` | **This class is deprecated.** GlesRenderer is deprecated |

Known indirect subclasses [ListenableCanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer2), [ListenableCanvasRenderer](https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer), [ListenableGlesRenderer2](https://developer.android.com/reference/androidx/wear/watchface/ListenableGlesRenderer2), [ListenableGlesRenderer](https://developer.android.com/reference/androidx/wear/watchface/ListenableGlesRenderer), [Renderer.CanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2), [Renderer.GlesRenderer2](https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer2)

|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer` | **This class is deprecated.** Use ListenableCanvasRenderer2 instead |
| `https://developer.android.com/reference/androidx/wear/watchface/ListenableGlesRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/androidx/wear/watchface/ListenableGlesRenderer` | **This class is deprecated.** Use ListenableGlesRenderer2 instead |
| `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The base class for `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer`, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2`, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer`, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer2`. Where possible it is recommended to use `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer2` which allow memory to be saved during editing because there can be more than one watchface instance during editing.

Renderers are constructed on a background thread but all rendering is done on the UiThread. There is a memory barrier between construction and rendering so no special threading primitives are required.

It is recommended to set `https://developer.android.com/reference/androidx/wear/watchface/Renderer#watchfaceColors()` with representative `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` this is used by compatible systems to influence the system's color scheme.

Please note `https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable.html` and similar classes which rely on `https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html` do not animate properly out of the box unless you register an implementation with `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setCallback(android.graphics.drawable.Drawable.Callback)` that calls `https://developer.android.com/reference/androidx/wear/watchface/Renderer#invalidate()`. Even then these classes are not recommend because the `https://developer.android.com/reference/java/time/ZonedDateTime.html` passed to `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)` is not guaranteed to match the system time (e.g. for taking screenshots). In addition care is needed when implementing `https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html` to ensure it does not animate in ambient mode which could lead to a significant power regression.

use Watch Face Format instead

## Summary

| ### Nested types |
|---|
| `public abstract class https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer extends https://developer.android.com/reference/androidx/wear/watchface/Renderer` **This class is deprecated.** CanvasRenderer is deprecated |
| `public abstract class https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2<SharedAssetsT extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets> extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer` **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `public abstract class https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer extends https://developer.android.com/reference/androidx/wear/watchface/Renderer` **This class is deprecated.** GlesRenderer is deprecated |
| `public final class https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer.GlesException extends https://developer.android.com/reference/java/lang/Exception.html` **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `public abstract class https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer2<SharedAssetsT extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets> extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer` **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `public interface https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets` **This interface is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Protected constructors |
|---|
| `@https://developer.android.com/reference/androidx/annotation/WorkerThread [Renderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer#Renderer(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Long))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository currentUserStyleRepository, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchState watchState, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel>>` | `[getAdditionalContentDescriptionLabels](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getAdditionalContentDescriptionLabels())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final float` | `[getCenterX](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getCenterX())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final float` | `[getCenterY](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getCenterY())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final long` | `[getInteractiveDrawModeUpdateDelayMillis](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getInteractiveDrawModeUpdateDelayMillis())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html` | `@https://developer.android.com/reference/androidx/annotation/UiThread [getMainClockElementBounds](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getMainClockElementBounds())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/RenderParameters` | `[getRenderParameters](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getRenderParameters())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html` | `[getScreenBounds](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getScreenBounds())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/SurfaceHolder.html` | `[getSurfaceHolder](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getSurfaceHolder())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` | `@https://developer.android.com/reference/androidx/wear/watchface/WatchFaceExperimental [getWatchfaceColors](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getWatchfaceColors())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [invalidate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#invalidate())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [onDestroy](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onDestroy())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [onDump](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onDump(java.io.PrintWriter))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/PrintWriter.html writer)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[postInvalidate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#postInvalidate())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[sendPreviewImageNeedsUpdateRequest](https://developer.android.com/reference/androidx/wear/watchface/Renderer#sendPreviewImageNeedsUpdateRequest())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[setAdditionalContentDescriptionLabels](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setAdditionalContentDescriptionLabels(kotlin.collections.Collection))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel>> value )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[setInteractiveDrawModeUpdateDelayMillis](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setInteractiveDrawModeUpdateDelayMillis(kotlin.Long))(long value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `@https://developer.android.com/reference/androidx/wear/watchface/WatchFaceExperimental [setWatchfaceColors](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setWatchfaceColors(androidx.wear.watchface.WatchFaceColors))(https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `boolean` | `@https://developer.android.com/reference/androidx/annotation/UiThread [shouldAnimate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#shouldAnimate())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Protected methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [onRenderParametersChanged](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onRenderParametersChanged(androidx.wear.watchface.RenderParameters))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/RenderParameters renderParameters)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[setSurfaceHolder](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setSurfaceHolder(android.view.SurfaceHolder))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/SurfaceHolder.html value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Protected constructors

### Renderer

```
@WorkerThread
protected [Renderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer#Renderer(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Long))(
    @NonNull SurfaceHolder surfaceHolder,
    @NonNull CurrentUserStyleRepository currentUserStyleRepository,
    @NonNull WatchState watchState,
    @IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder` | The `https://developer.android.com/reference/android/view/SurfaceHolder.html` that `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderInternal(java.time.ZonedDateTime)` will draw into. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository currentUserStyleRepository` | The associated `https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchState watchState` | The associated `https://developer.android.com/reference/androidx/wear/watchface/WatchState`. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis` | The interval in milliseconds between frames in interactive `https://developer.android.com/reference/androidx/wear/watchface/DrawMode`s. To render at 60hz set to 16. Note when battery is low, the frame rate will be clamped to 10fps. Watch faces are recommended to use lower frame rates if possible for better battery life. Variable frame rates can also help preserve battery life, e.g. if a watch face has a short animation once per second it can adjust the frame rate inorder to sleep when not animating. In ambient mode the watch face will be rendered once per minute. |

## Public methods

### getAdditionalContentDescriptionLabels

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final @NonNull Collection<@NonNull Pair<@NonNull Integer, @NonNull ContentDescriptionLabel>> [getAdditionalContentDescriptionLabels](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getAdditionalContentDescriptionLabels())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Accessibility `https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel` for any rendered watch face elements other than the time and `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s which are generated automatically.

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` in the `Pair<Int, ContentDescriptionLabel>` is used to sort the `https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel`s. Note the time piece has an accessibility traversal index of -1 and each `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`'s index is defined by its `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot#accessibilityTraversalIndex()`.

### getCenterX

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final float [getCenterX](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getCenterX())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The center x coordinate of the `https://developer.android.com/reference/android/view/SurfaceHolder.html` this Renderer renders into.

### getCenterY

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final float [getCenterY](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getCenterY())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The center y coordinate of the `https://developer.android.com/reference/android/view/SurfaceHolder.html` this Renderer renders into.

### getInteractiveDrawModeUpdateDelayMillis

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final long [getInteractiveDrawModeUpdateDelayMillis](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getInteractiveDrawModeUpdateDelayMillis())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The interval in milliseconds between frames in interactive `https://developer.android.com/reference/androidx/wear/watchface/DrawMode`s. To render at 60hz set to 16. Note when battery is low, the frame rate will be clamped to 10fps. Watch faces are recommended to use lower frame rates if possible for better battery life. Variable frame rates can also help preserve battery life, e.g. if a watch face has a short animation once per second it can adjust the frame rate inorder to sleep when not animating. In ambient mode the watch face will be rendered once per minute.

### getMainClockElementBounds

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
public @NonNull Rect [getMainClockElementBounds](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getMainClockElementBounds())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

This method is used for accessibility support to describe the portion of the screen containing the main clock element. By default we assume this is contained in the central half of the watch face. Watch faces should override this to return the correct bounds for the main clock element.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the watch faces' main clock element |

### getRenderParameters

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final @NonNull RenderParameters [getRenderParameters](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getRenderParameters())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The current `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters`. Updated before every onDraw call.

### getScreenBounds

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final @NonNull Rect [getScreenBounds](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getScreenBounds())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The bounds of the `https://developer.android.com/reference/android/view/SurfaceHolder.html` this Renderer renders into. Depending on the shape of the device's screen not all of these pixels may be visible to the user (see `https://developer.android.com/reference/android/content/res/Configuration.html#isScreenRound()`). Note also that API level 27+ devices draw indicators in the top and bottom 24dp of the screen, avoid rendering anything important there.

### getSurfaceHolder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final @NonNull SurfaceHolder [getSurfaceHolder](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getSurfaceHolder())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The `https://developer.android.com/reference/android/view/SurfaceHolder.html` that `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderInternal(java.time.ZonedDateTime)` will draw into.

### getWatchfaceColors

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@WatchFaceExperimental
public final WatchFaceColors [getWatchfaceColors](https://developer.android.com/reference/androidx/wear/watchface/Renderer#getWatchfaceColors())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Representative `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` which are made available to system clients via androidx.wear.watchface.client.InteractiveWatchFaceClient.OnWatchFaceColorsListener.

Initially this value is `null` signifying that the colors are unknown. When possible the watchFace should assign `non null` `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` and keep this updated when the colors change (e.g. due to a style change).

### invalidate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
public final void [invalidate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#invalidate())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Schedules a call to either `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)` to draw the next frame.

### onDestroy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
public void [onDestroy](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onDestroy())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when the Renderer is destroyed.

### onDump

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
public abstract void [onDump](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onDump(java.io.PrintWriter))(@NonNull PrintWriter writer)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when adb shell dumpsys is invoked for the WatchFaceService, allowing the renderer to optionally record state for debugging purposes.

### postInvalidate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final void [postInvalidate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#postInvalidate())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Posts a message to schedule a call to either `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)` to draw the next frame. Unlike `https://developer.android.com/reference/androidx/wear/watchface/Renderer#invalidate()`, this method is thread-safe and may be called on any thread.

### sendPreviewImageNeedsUpdateRequest

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final void [sendPreviewImageNeedsUpdateRequest](https://developer.android.com/reference/androidx/wear/watchface/Renderer#sendPreviewImageNeedsUpdateRequest())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Sends a request to the system asking it to update the preview image. This is useful for watch faces with configuration outside of the `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSchema` E.g. a watchface with a selectable background.

The system may choose to rate limit this method for performance reasons and the system is free to schedule when the update occurs.

Requires a compatible system to work (if the system is incompatible this does nothing). This can be called from any thread.

### setAdditionalContentDescriptionLabels

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final void [setAdditionalContentDescriptionLabels](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setAdditionalContentDescriptionLabels(kotlin.collections.Collection))(
    @NonNull Collection<@NonNull Pair<@NonNull Integer, @NonNull ContentDescriptionLabel>> value
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Accessibility `https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel` for any rendered watch face elements other than the time and `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s which are generated automatically.

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` in the `Pair<Int, ContentDescriptionLabel>` is used to sort the `https://developer.android.com/reference/androidx/wear/watchface/ContentDescriptionLabel`s. Note the time piece has an accessibility traversal index of -1 and each `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`'s index is defined by its `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot#accessibilityTraversalIndex()`.

### setInteractiveDrawModeUpdateDelayMillis

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
public final void [setInteractiveDrawModeUpdateDelayMillis](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setInteractiveDrawModeUpdateDelayMillis(kotlin.Long))(long value)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

| Parameters |
|---|---|
| `long value` | The interval in milliseconds between frames in interactive `https://developer.android.com/reference/androidx/wear/watchface/DrawMode`s. To render at 60hz set to 16. Note when battery is low, the frame rate will be clamped to 10fps. Watch faces are recommended to use lower frame rates if possible for better battery life. Variable frame rates can also help preserve battery life, e.g. if a watch face has a short animation once per second it can adjust the frame rate inorder to sleep when not animating. In ambient mode the watch face will be rendered once per minute. |

### setWatchfaceColors

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@WatchFaceExperimental
public final void [setWatchfaceColors](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setWatchfaceColors(androidx.wear.watchface.WatchFaceColors))(WatchFaceColors value)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Representative `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` which are made available to system clients via androidx.wear.watchface.client.InteractiveWatchFaceClient.OnWatchFaceColorsListener.

Initially this value is `null` signifying that the colors are unknown. When possible the watchFace should assign `non null` `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceColors` and keep this updated when the colors change (e.g. due to a style change).

### shouldAnimate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
public boolean [shouldAnimate](https://developer.android.com/reference/androidx/wear/watchface/Renderer#shouldAnimate())()
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The system periodically (at least once per minute) calls onTimeTick() to trigger a display update. If the watch face needs to animate with an interactive frame rate, calls to invalidate must be scheduled. This method controls whether or not we should do that and if shouldAnimate returns true we inhibit entering `https://developer.android.com/reference/androidx/wear/watchface/DrawMode#AMBIENT`.

By default we remain at an interactive frame rate when the watch face is visible and we're not in ambient mode. Watch faces with animated transitions for entering ambient mode may need to override this to ensure they play smoothly.

| Returns |
|---|---|
| `boolean` | Whether we should schedule an onDraw call to maintain an interactive frame rate |

## Protected methods

### onRenderParametersChanged

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
protected void [onRenderParametersChanged](https://developer.android.com/reference/androidx/wear/watchface/Renderer#onRenderParametersChanged(androidx.wear.watchface.RenderParameters))(@NonNull RenderParameters renderParameters)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters` has been updated. Will always be called before the first call to `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)`.

### setSurfaceHolder

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
protected final void [setSurfaceHolder](https://developer.android.com/reference/androidx/wear/watchface/Renderer#setSurfaceHolder(android.view.SurfaceHolder))(@NonNull SurfaceHolder value)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The `https://developer.android.com/reference/android/view/SurfaceHolder.html` that `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderInternal(java.time.ZonedDateTime)` will draw into.