# CanvasComplicationDrawable

Artifact: [androidx.wear.watchface:watchface-complications-rendering](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable.kt+class:androidx.wear.watchface.complications.rendering.CanvasComplicationDrawable) 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 class CanvasComplicationDrawable implements CanvasComplication
```

<br />

*** ** * ** ***

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

A complication rendered with `https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/ComplicationDrawable` which renders complicationSlots in a material design style. This renderer can't be shared by multiple complicationSlots.

use Watch Face Format instead

## Summary

| ### Public constructors |
|---|
| `[CanvasComplicationDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#CanvasComplicationDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable,androidx.wear.watchface.WatchState,androidx.wear.watchface.CanvasComplication.InvalidateCallback))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/ComplicationDrawable drawable, @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/NonNull https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication.InvalidateCallback invalidateCallback )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `void` | `[drawHighlight](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int))( @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, int boundsType, @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/ColorInt int color )` **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/androidx/wear/watchface/complications/data/ComplicationData` | `[getData](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getData())()` **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/complications/rendering/ComplicationDrawable` | `[getDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getDrawable())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper [loadData](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData complicationData, boolean loadDrawablesAsynchronous )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `void` | `[render](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.RenderParameters,kotlin.Int))( @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 https://developer.android.com/reference/androidx/wear/watchface/RenderParameters renderParameters, int slotId )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[setDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#setDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/ComplicationDrawable value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Inherited methods |
|---|
| From [androidx.wear.watchface.CanvasComplication](https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication) |---|---| | `void` | `@https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationExperimental [drawHighlight](https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int,androidx.wear.watchface.BoundingArc))( @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, int boundsType, @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/ColorInt int color, https://developer.android.com/reference/androidx/wear/watchface/BoundingArc boundingArc )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. | | `void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread [onRendererCreated](https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication#onRendererCreated(androidx.wear.watchface.Renderer))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/Renderer renderer)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. | |

## Public constructors

### CanvasComplicationDrawable

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 [CanvasComplicationDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#CanvasComplicationDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable,androidx.wear.watchface.WatchState,androidx.wear.watchface.CanvasComplication.InvalidateCallback))(
    @NonNull ComplicationDrawable drawable,
    @NonNull WatchState watchState,
    @NonNull CanvasComplication.InvalidateCallback invalidateCallback
)
```

> [!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/androidx/wear/watchface/complications/rendering/ComplicationDrawable drawable` | The `https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/ComplicationDrawable` to render with. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchState watchState` | The watch's `https://developer.android.com/reference/androidx/wear/watchface/WatchState` which contains details pertaining to (low-bit) ambient mode and burn in protection needed to render correctly. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication.InvalidateCallback invalidateCallback` | The `https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication.InvalidateCallback` associated with which can be used to request screen redrawing and to report updates |

## Public methods

### drawHighlight

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 void [drawHighlight](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    int boundsType,
    @NonNull ZonedDateTime zonedDateTime,
    @ColorInt int color
)
```

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

Draws a highlight for a `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotBoundsType#ROUND_RECT()` complication. The default implementation does this by drawing a dashed line around the complication, other visual effects may be used if desired.

| 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 |
| `@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 bounds of the complication |
| `int boundsType` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotBoundsTypeIntDef` of the complication |
| `@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 the highlight with |
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int color` | The color to render the highlight with |

### getData

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 @NonNull ComplicationData [getData](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getData())()
```

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

Returns the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` to render with. This defaults to `https://developer.android.com/reference/androidx/wear/watchface/complications/data/NoDataComplicationData`.

### getDrawable

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 ComplicationDrawable [getDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getDrawable())()
```

> [!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/androidx/wear/watchface/complications/rendering/ComplicationDrawable` to render with.

### loadData

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)

```
@CallSuper
public void [loadData](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean))(
    @NonNull ComplicationData complicationData,
    boolean loadDrawablesAsynchronous
)
```

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

Updates the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` used for rendering and loads any `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`s within the `https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData complicationData` | The new `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationData` for which any `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`s should be loaded |
| `boolean loadDrawablesAsynchronous` | Whether any `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`s within `https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean)` should be loaded asynchronously or not. If they are loaded asynchronously then upon completion, `https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/ComplicationDrawable#setComplicationData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean)` will call `https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html#invalidateDrawable(android.graphics.drawable.Drawable)` registered in our init section above, which invalidates the attachedComplication and ultimately the watch face. |

### render

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 void [render](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.RenderParameters,kotlin.Int))(
    @NonNull Canvas canvas,
    @NonNull Rect bounds,
    @NonNull ZonedDateTime zonedDateTime,
    @NonNull RenderParameters renderParameters,
    int slotId
)
```

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

Draws the complication defined by `https://developer.android.com/reference/androidx/wear/watchface/CanvasComplication#getData()` into the canvas with the specified bounds. This will usually be called by user watch face drawing code, but the system may also call it for complication selection UI rendering. The width and height will be the same as that computed by computeBounds but the translation and canvas size may differ.

| 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 |
| `@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 bounds of the complication |
| `@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 https://developer.android.com/reference/androidx/wear/watchface/RenderParameters renderParameters` | The current `https://developer.android.com/reference/androidx/wear/watchface/RenderParameters` |
| `int slotId` | The Id of the `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` being rendered |

### setDrawable

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 [setDrawable](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#setDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable))(@NonNull ComplicationDrawable 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/androidx/wear/watchface/complications/rendering/ComplicationDrawable` to render with.