# Renderer.CanvasRenderer2

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.CanvasRenderer2) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
public abstract class Renderer.CanvasRenderer2<SharedAssetsT extends Renderer.SharedAssets> extends Renderer.CanvasRenderer
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.wear.watchface.Renderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer) |||
|   | ↳ | [androidx.wear.watchface.Renderer.CanvasRenderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer) ||
|   |   | ↳ | [androidx.wear.watchface.Renderer.CanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2) |

Known direct subclasses [ListenableCanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer2)

|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer2` | **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

Watch faces that require `https://developer.android.com/reference/android/graphics/Canvas.html` rendering and are able to take advantage of `https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets` to save memory (there can be more than once instance when editing), should extend their `https://developer.android.com/reference/androidx/wear/watchface/Renderer` from this class.

A CanvasRenderer is expected to be constructed on the background thread associated with `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService#getBackgroundThreadHandler()` inside a call to `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService#createWatchFace(android.view.SurfaceHolder,androidx.wear.watchface.WatchState,androidx.wear.watchface.ComplicationSlotsManager,androidx.wear.watchface.style.CurrentUserStyleRepository)`. All rendering is be done on the UiThread. There is a memory barrier between construction and rendering so no special threading primitives are required.

In Java it may be easier to extend `https://developer.android.com/reference/androidx/wear/watchface/ListenableCanvasRenderer2` instead.

use Watch Face Format instead

| Parameters |
|---|---|
| `<SharedAssetsT extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets>` | The type extending `https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets` returned by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets()` and passed into `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` and `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)`. |

## Summary

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/androidx/annotation/WorkerThread <SharedAssetsT extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets> [CanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#CanvasRenderer2(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Int,kotlin.Long,kotlin.Boolean))( @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, int canvasType, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis, boolean clearWithBackgroundTintBeforeRenderingHighlightLayer )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `final void` | `[render](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [render](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime, @https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT sharedAssets )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[renderHighlightLayer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [renderHighlightLayer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime, @https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT sharedAssets )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Protected methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread [createSharedAssets](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

### Inherited methods

From [androidx.wear.watchface.Renderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer) `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.
`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` `[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` `[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.
`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.
From [androidx.wear.watchface.Renderer.CanvasRenderer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer) `final boolean` `[getClearWithBackgroundTintBeforeRenderingHighlightLayer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#getClearWithBackgroundTintBeforeRenderingHighlightLayer())()`

**This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`void` `@https://developer.android.com/reference/androidx/annotation/UiThread
[init](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#init())()`

**This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`void` `[onDump](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#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.

## Public constructors

### CanvasRenderer2

```
@WorkerThread
public <SharedAssetsT extends Renderer.SharedAssets> [CanvasRenderer2](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#CanvasRenderer2(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Int,kotlin.Long,kotlin.Boolean))(
    @NonNull SurfaceHolder surfaceHolder,
    @NonNull CurrentUserStyleRepository currentUserStyleRepository,
    @NonNull WatchState watchState,
    int canvasType,
    @IntRange(from = 0, to = 60000) long interactiveDrawModeUpdateDelayMillis,
    boolean clearWithBackgroundTintBeforeRenderingHighlightLayer
)
```

> [!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 |
|---|---|
| `<SharedAssetsT extends https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets>` | The type extending `https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets` returned by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets()` and passed into `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` and `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)`. |
| `@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` from which a `https://developer.android.com/reference/android/graphics/Canvas.html` to will be obtained and passed into `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository currentUserStyleRepository` | The watch face's 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 watch face's associated `https://developer.android.com/reference/androidx/wear/watchface/WatchState`. |
| `int canvasType` | The `https://developer.android.com/reference/androidx/wear/watchface/CanvasTypeIntDef` to request. Note even if `https://developer.android.com/reference/androidx/wear/watchface/CanvasType#HARDWARE()` is used, screenshots will taken using the software rendering pipeline, as such `https://developer.android.com/reference/android/graphics/Bitmap.html`s with `https://developer.android.com/reference/android/graphics/Bitmap.Config.html#HARDWARE` must be avoided. Value is one of the following: - `0` - `1` <br /> |
| `@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 framerate inorder to sleep when not animating. |
| `boolean clearWithBackgroundTintBeforeRenderingHighlightLayer` | Whether the `https://developer.android.com/reference/android/graphics/Canvas.html` is cleared with `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` is called. Defaults to `false`. |

## Public methods

### render

```
public final void [render](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    @NonNull ZonedDateTime zonedDateTime
)
```

> [!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

Sub-classes should override this to implement their watch face rendering logic which should respect the current `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderParameters()`. Please note `https://developer.android.com/reference/androidx/wear/watchface/WatchState#isAmbient()` may not match the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#drawMode()` and should not be used to decide what to render. E.g. when editing from the companion phone while the watch is ambient, renders may be requested with `https://developer.android.com/reference/androidx/wear/watchface/DrawMode#INTERACTIVE`.

Any highlights due to `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#highlightLayer()` should be rendered by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` instead where possible. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Before any calls to render, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#init()` will be called once.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into. Don't assume this is always the canvas from the `https://developer.android.com/reference/android/view/SurfaceHolder.html` backing the display |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bonds of the canvas to draw into |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime` | The `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |

### render

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

```
@UiThread
public abstract void [render](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    @NonNull ZonedDateTime zonedDateTime,
    @NonNull SharedAssetsT sharedAssets
)
```

> [!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

Sub-classes should override this to implement their watch face rendering logic which should respect the current `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderParameters()`. Please note `https://developer.android.com/reference/androidx/wear/watchface/WatchState#isAmbient()` may not match the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#drawMode()` and should not be used to decide what to render. E.g. when editing from the companion phone while the watch is ambient, renders may be requested with `https://developer.android.com/reference/androidx/wear/watchface/DrawMode#INTERACTIVE`.

Any highlights due to `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#highlightLayer()` should be rendered by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` instead where possible. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Before any calls to render, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#init()` will be called once.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into. Don't assume this is always the canvas from the `https://developer.android.com/reference/android/view/SurfaceHolder.html` backing the display |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bonds of the canvas to draw into |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime` | The `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |
| `@https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT sharedAssets` | The `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2` returned by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets()` |

### renderHighlightLayer

```
public final void [renderHighlightLayer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    @NonNull ZonedDateTime zonedDateTime
)
```

> [!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

Sub-classes should override this to implement their watch face highlight layer rendering logic for the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#highlightLayer()` aspect of `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderParameters()`. Typically the implementation will clear `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` to `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before rendering a transparent highlight or a solid outline around the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#highlightedElement()`. This will be composited as needed on top of the results of `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)`. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Note if `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#clearWithBackgroundTintBeforeRenderingHighlightLayer()` is `true` then `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)` will cleared with `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before renderHighlightLayer is called. Otherwise it is up to the overridden function to clear the Canvas if necessary.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into. Don't assume this is always the canvas from the `https://developer.android.com/reference/android/view/SurfaceHolder.html` backing the display |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bonds of the canvas to draw into |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime` | the `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |

### renderHighlightLayer

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

```
@UiThread
public abstract void [renderHighlightLayer](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    @NonNull ZonedDateTime zonedDateTime,
    @NonNull SharedAssetsT sharedAssets
)
```

> [!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

Sub-classes should override this to implement their watch face highlight layer rendering logic for the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters#highlightLayer()` aspect of `https://developer.android.com/reference/androidx/wear/watchface/Renderer#renderParameters()`. Typically the implementation will clear `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` to `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before rendering a transparent highlight or a solid outline around the `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#highlightedElement()`. This will be composited as needed on top of the results of `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)`. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Note if `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer#clearWithBackgroundTintBeforeRenderingHighlightLayer()` is `true` then `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` will cleared with `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before renderHighlightLayer is called. Otherwise it is up to the overridden function to clear the Canvas if necessary.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into. Don't assume this is always the canvas from the `https://developer.android.com/reference/android/view/SurfaceHolder.html` backing the display |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bonds of the canvas to draw into |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/ZonedDateTime.html zonedDateTime` | the `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |
| `@https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT sharedAssets` | The `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2` returned by `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets()` |

## Protected methods

### createSharedAssets

```
@WorkerThread
protected abstract @NonNull SharedAssetsT [createSharedAssets](https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#createSharedAssets())()
```

> [!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

When editing multiple `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService` instances and hence Renderers can exist concurrently (e.g. a headless instance and an interactive instance) and using `https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets` allows memory to be saved by sharing immutable data (e.g. Bitmaps, shaders, etc...) between them.

To take advantage of SharedAssets, override this method. The constructed SharedAssets are passed into the `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` as an argument (NB you'll have to cast this to your type).

When all instances using SharedAssets have been closed, `https://developer.android.com/reference/androidx/wear/watchface/Renderer.SharedAssets#onDestroy()` will be called.

Note that while SharedAssets are constructed on a background thread, they'll typically be used on the main thread and subsequently destroyed there.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SharedAssetsT` | The `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2` that will be passed into `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)` and `https://developer.android.com/reference/androidx/wear/watchface/Renderer.CanvasRenderer2#renderHighlightLayer(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.Renderer.SharedAssets)`. |