> ## Documentation Index
> Fetch the complete documentation index at: https://rive.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Canvas

A Rive 2-D renderer canvas. Use `.image` with `renderer:drawImage()`.
Call `beginFrame()` to get a Renderer, issue draw calls, then `endFrame()`.

## Fields

### `image`

Backing image for `renderer:drawImage()`.

### `width`

Width in pixels.

### `height`

Height in pixels.

## Methods

### `resize`

<div class="signature">
  ```lua theme={null}
  resize(width: number, height: number) -> ()
  ```
</div>

Resize the canvas. Must not be called between beginFrame() and endFrame().

### `beginFrame`

<div class="signature">
  ```lua theme={null}
  beginFrame(desc: {clearColor: Color?}?) -> Renderer
  ```
</div>

Begin a Rive frame. Returns a Renderer valid until endFrame().
clearColor is an ARGB integer (e.g. 0xFF000000 = opaque black; default transparent).

### `endFrame`

<div class="signature">
  ```lua theme={null}
  endFrame() -> ()
  ```
</div>

Flush draw calls to the backing texture and release the Renderer.
