Google is committed to advancing racial equity for Black communities. See how.

CanvasRenderer

abstract class CanvasRenderer : Renderer
kotlin.Any
   ↳ androidx.wear.watchface.Renderer
   ↳ androidx.wear.watchface.CanvasRenderer

Watch faces that require Canvas rendering should extend their Renderer from this class.

Summary

Public constructors
<init>(surfaceHolder: SurfaceHolder, userStyleRepository: UserStyleRepository, watchState: WatchState, canvasType: Int)

Watch faces that require Canvas rendering should extend their Renderer from this class.

Public methods
abstract Unit
render(canvas: Canvas, bounds: Rect, calendar: Calendar)

Sub-classes should override this to implement their rendering logic which should respect the current DrawMode.

Inherited functions
Inherited properties

Public constructors

<init>

CanvasRenderer(
    surfaceHolder: SurfaceHolder,
    userStyleRepository: UserStyleRepository,
    watchState: WatchState,
    canvasType: Int)

Watch faces that require Canvas rendering should extend their Renderer from this class.

Public methods

render

@UiThread abstract fun render(
    canvas: Canvas,
    bounds: Rect,
    calendar: Calendar
): Unit

Sub-classes should override this to implement their rendering logic which should respect the current DrawMode. For correct functioning watch faces must use the supplied Calendar and avoid using any other ways of getting the time.

Parameters
canvas: Canvas The Canvas to render into. Don't assume this is always the canvas from the SurfaceHolder backing the display
bounds: Rect A Rect describing the bonds of the canvas to draw into
calendar: Calendar The current Calendar