# Canvas

with Discord.Short you can create an image like you would do using JavaScript with html:

```javascript
const canvas = new Discord.Canvas(200, 200); // width, height
const ctx = canvas.getContext('2d');
```

you can create simple shapes and text:

```javascript
ctx.rect(10, 10, 30, 30); // x, y, width, height
ctx.ellipse(30, 40, 20, 20); // x, y, width, height
ctx.text('hello world', 20, 100, 20, 'arial'); // text, x, y, size?, font?
```

you can add a background and change the color of these shapes like this:

```javascript
ctx.background('#121212'); // color (hex, rgb)
ctx.fill('rgb(255, 0, 130)'); // color (hex, rgb)
```

you can make masks...

```javascript
ctx.beginMask('example'); // mask id
ctx.rect(20, 20, 50, 50);
ctx.closeMask();
```

and add them to shapes:

```javascript
ctx.mask('example'); // mask id
ctx.fill('#4912fe');
ctx.rect(10, 10, 70, 70);
```

and if you want, you can use an `svg`:

```javascript
ctx.svg('path/to/file.svg'); // filepath
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ephf.gitbook.io/discord-short/canvas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
