---
name: "CanvasContext.draw"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "draw"
---

## CanvasContext.draw

> [VERSION] Base Library >= 2.21.8

### Description

Render the previously defined paths, transforms, and styles in the drawing context onto the canvas

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `reserve` | `boolean` | No | Whether to retain the current content on the canvas; false by default |

### Return Value

None


### Examples

#### Draw and retain content

```ts
const ctx = ty.createCanvasContext('myCanvas');
ctx.setFillStyle('#ff0000');
ctx.fillRect(10, 10, 50, 50);
ctx.draw();
// Append drawing
ctx.setFillStyle('#0000ff');
ctx.fillRect(70, 10, 50, 50);
ctx.draw(true);
```
