| Crates.io | embedded-canvas |
| lib.rs | embedded-canvas |
| version | 0.3.2 |
| created_at | 2022-05-17 08:32:23.490006+00 |
| updated_at | 2025-08-25 08:55:39.356907+00 |
| description | Draw anything with ease on the Canvas before drawing it to your small hardware display |
| homepage | https://github.com/LechevSpace/embedded-canvas |
| repository | https://github.com/LechevSpace/embedded-canvas |
| max_upload_size | |
| id | 588220 |
| size | 95,865 |
embedded-canvascanvas - a piece of cloth backed or framed as a surface for a painting
NOTE: This crate is still in development and may have breaking changes from one version to another.
embedded-canvas is a convenient crate for embedded-graphics
and provides a Canvas and CanvasAt on which you
can draw anything with ease before drawing the pixels on the embedded display.
Based on embedded-graphics-core and embedded-graphics
(see transform feature in Crate features).
This crate is no_std and it has 2 sets of canvases:
Canvas and CanvasAt - require alloc featureCCanvas and CCanvasAt - do not require alloc feature because they
use const generics instead.The main advantages of the canvases in this crate are:

Example: Transparency - The canvas content (a circle) is drawn on the display where there's already a drawn square.

Example: Cropping text - The full canvas content is drawn on the left and only portion of it is cropped and drawn on the right.
There are two main canvases you can work with:
Canvas / CCanavasA canvas which you can draw on with origin Point::zero().
The canvas location is not set for the provided display.
After drawing decide where to place it on the display using the methods:
Canvas::place_at(top_left: Point) -> CanvasAt (with alloc feature) or CCanvas::place_at(top_left: Point) -> CCanvasAtCanvas::place_center(center: Point) -> CanvasAt (with alloc feature) or CCanvas::place_center(center: Point) -> CCanvasAtCanvasAt / CCanvasAtCanvasAt/CCanvasAt are a type of canvas ready to be drawn on the display at specified
location (hence the name CanvasAt/CCanvasAt).
There are two ways of using CanvasAt/CCanvasAt:
CanvasAt/CCanavasAt on specified location on the display and drawing inside.Canvas/CCanvas and when ready to draw it on the display place the
Canvas/CCanvas at specified location using the methods:
Canvas::place_at(top_left: Point) -> CanvasAt (with alloc feature) and CCanvas::place_at(top_left: Point) -> CCanvasAtCanvas::place_center(center: Point) -> CanvasAt (with alloc feature) and CCanvas::place_center(center: Point) -> CCanvasAtdefault features - transform
alloc - enables Canvas and CanvasAt.
transform - enables the trait implementation of embedded_graphics::transform::Transform for CanvasAt.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.