> For the complete documentation index, see [llms.txt](https://paytonturnage.gitbook.io/valora/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paytonturnage.gitbook.io/valora/the-basics.md).

# Painting the Canvas

The central component of valora is the [Canvas](https://docs.rs/valora/0.2.0/valora/canvas/struct.Canvas.html). The canvas supports many low level drawing operations such as drawing paths and stroking or filling them. For example, we can draw a triangle like this:

```rust
canvas.set_color(LinSrgb::new(1., 0., 1.));
canvas.move_to(P2::new(430., 225.));
canvas.line_to(P2::new(83., 225.));
canvas.line_to(P2::new(256., 525.));
canvas.close_path();
canvas.set_stroke_width(10.);
canvas.stroke();
```

![A stroked triangle.](/files/-LwF205PlsMoMRPanVM0)

Thankfully in valora we don't have to work at such a low level unless we want to. Valora defines the [Paint](https://docs.rs/valora/0.2.0/valora/paint/trait.Paint.html) trait, which is implemented by any type that knows how to represent itself on a canvas. We can instead draw an equilateral triangle like this:

```rust
canvas.set_color(LinSrgb::new(1., 0., 1.));
canvas.paint(Stroked {
    width: 2.,
    element: Ngon::triangle(world.center(), /*radius=*/200.),
});
```

You can implement `Paint` for your own patterns and easily compose them, as we will see in later chapters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://paytonturnage.gitbook.io/valora/the-basics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
