# 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)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable "View this page in Java")


```
open class CanvasComplicationDrawable : 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/kotlin/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/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#CanvasComplicationDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable,androidx.wear.watchface.WatchState,androidx.wear.watchface.CanvasComplication.InvalidateCallback))( drawable: https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/ComplicationDrawable, watchState: https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchState, invalidateCallback: https://developer.android.com/reference/kotlin/androidx/wear/watchface/CanvasComplication.InvalidateCallback )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[drawHighlight](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int))( canvas: https://developer.android.com/reference/android/graphics/Canvas.html, bounds: https://developer.android.com/reference/android/graphics/Rect.html, boundsType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html, color: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationData` | `[getData](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getData())()` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper [loadData](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean))( complicationData: https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationData, loadDrawablesAsynchronous: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[render](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.RenderParameters,kotlin.Int))( canvas: https://developer.android.com/reference/android/graphics/Canvas.html, bounds: https://developer.android.com/reference/android/graphics/Rect.html, zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html, renderParameters: https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters, slotId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/ComplicationDrawable` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#drawable()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Inherited functions |
|---|
| From [androidx.wear.watchface.CanvasComplication](https://developer.android.com/reference/kotlin/androidx/wear/watchface/CanvasComplication) |---|---| | `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationExperimental [drawHighlight](https://developer.android.com/reference/kotlin/androidx/wear/watchface/CanvasComplication#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int,androidx.wear.watchface.BoundingArc))( canvas: https://developer.android.com/reference/android/graphics/Canvas.html, bounds: https://developer.android.com/reference/android/graphics/Rect.html, boundsType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html, color: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, boundingArc: https://developer.android.com/reference/kotlin/androidx/wear/watchface/BoundingArc? )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. | | `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread [onRendererCreated](https://developer.android.com/reference/kotlin/androidx/wear/watchface/CanvasComplication#onRendererCreated(androidx.wear.watchface.Renderer))(renderer: https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer)` **This function 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)

```
[CanvasComplicationDrawable](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#CanvasComplicationDrawable(androidx.wear.watchface.complications.rendering.ComplicationDrawable,androidx.wear.watchface.WatchState,androidx.wear.watchface.CanvasComplication.InvalidateCallback))(
    drawable: ComplicationDrawable,
    watchState: WatchState,
    invalidateCallback: CanvasComplication.InvalidateCallback
)
```

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

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

## Public functions

### 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)

```
open fun [drawHighlight](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#drawHighlight(android.graphics.Canvas,android.graphics.Rect,kotlin.Int,java.time.ZonedDateTime,kotlin.Int))(
    canvas: Canvas,
    bounds: Rect,
    boundsType: Int,
    zonedDateTime: ZonedDateTime,
    color: @ColorInt Int
): Unit
```

> [!CAUTION]
> **This function 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/kotlin/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 |
|---|---|
| `canvas: https://developer.android.com/reference/android/graphics/Canvas.html` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into |
| `bounds: https://developer.android.com/reference/android/graphics/Rect.html` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the complication |
| `boundsType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotBoundsTypeIntDef` of the complication |
| `zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html` | The `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render the highlight with |
| `color: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | 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)

```
open fun [getData](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#getData())(): ComplicationData
```

> [!CAUTION]
> **This function 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/kotlin/androidx/wear/watchface/complications/data/ComplicationData` to render with. This defaults to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/NoDataComplicationData`.

### 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
open fun [loadData](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean))(
    complicationData: ComplicationData,
    loadDrawablesAsynchronous: Boolean
): Unit
```

> [!CAUTION]
> **This function 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/kotlin/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/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#loadData(androidx.wear.watchface.complications.data.ComplicationData,kotlin.Boolean)`.

| Parameters |
|---|---|
| `complicationData: https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationData` | The new `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationData` for which any `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`s should be loaded |
| `loadDrawablesAsynchronous: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether any `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`s within `https://developer.android.com/reference/kotlin/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/kotlin/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)

```
open fun [render](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/rendering/CanvasComplicationDrawable#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime,androidx.wear.watchface.RenderParameters,kotlin.Int))(
    canvas: Canvas,
    bounds: Rect,
    zonedDateTime: ZonedDateTime,
    renderParameters: RenderParameters,
    slotId: Int
): Unit
```

> [!CAUTION]
> **This function 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/kotlin/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 |
|---|---|
| `canvas: https://developer.android.com/reference/android/graphics/Canvas.html` | The `https://developer.android.com/reference/android/graphics/Canvas.html` to render into |
| `bounds: https://developer.android.com/reference/android/graphics/Rect.html` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the complication |
| `zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html` | The `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |
| `renderParameters: https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters` | The current `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters` |
| `slotId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The Id of the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot` being rendered |

## Public properties

### drawable

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)

```
var drawable: ComplicationDrawable
```

> [!CAUTION]
> **This property 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/kotlin/androidx/wear/watchface/complications/rendering/ComplicationDrawable` to render with.