{"id":15295208,"url":"https://github.com/lechevspace/embedded-canvas","last_synced_at":"2025-05-08T21:12:34.703Z","repository":{"id":37893394,"uuid":"491620542","full_name":"LechevSpace/embedded-canvas","owner":"LechevSpace","description":"A canvas on which you can draw anything with ease before drawing the pixels on your small hardware display.","archived":false,"fork":false,"pushed_at":"2024-11-15T09:45:20.000Z","size":123,"stargazers_count":19,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T21:12:08.673Z","etag":null,"topics":["2d","2d-graphics","canvas","draw","embedded","graphics","graphics-library","rust","rustlang"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/embedded-canvas","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LechevSpace.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["LechevSpace"]}},"created_at":"2022-05-12T18:09:26.000Z","updated_at":"2024-12-30T22:26:57.000Z","dependencies_parsed_at":"2024-05-11T20:22:27.234Z","dependency_job_id":"331b5453-14f8-46ca-b0b9-2716d8b0282b","html_url":"https://github.com/LechevSpace/embedded-canvas","commit_stats":{"total_commits":33,"total_committers":3,"mean_commits":11.0,"dds":0.1515151515151515,"last_synced_commit":"4cb962a28b081a249ca9decda3f92033047495e3"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LechevSpace%2Fembedded-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LechevSpace%2Fembedded-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LechevSpace%2Fembedded-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LechevSpace%2Fembedded-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LechevSpace","download_url":"https://codeload.github.com/LechevSpace/embedded-canvas/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149617,"owners_count":21861739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","2d-graphics","canvas","draw","embedded","graphics","graphics-library","rust","rustlang"],"created_at":"2024-09-30T17:09:02.946Z","updated_at":"2025-05-08T21:12:34.605Z","avatar_url":"https://github.com/LechevSpace.png","language":"Rust","funding_links":["https://github.com/sponsors/LechevSpace","https://github.com/sponsors/LechevSpace)\u0026ensp;"],"categories":[],"sub_categories":[],"readme":"# `embedded-canvas`\n[![sponsor-us]](https://github.com/sponsors/LechevSpace)\u0026ensp;[![crates-io]](https://crates.io/crates/embedded-canvas)\u0026ensp;[![docs-rs]](https://docs.rs/embedded-canvas)\n\n\u003e canvas - a piece of cloth backed or framed as a surface for a painting\n\n_**NOTE:** This crate is still in development and may have breaking changes from\none version to another._\n\n`embedded-canvas` is a convenient crate for [`embedded-graphics`]\nand provides a [`Canvas`](#canvas) and [`CanvasAt`](#canvasat) on which you\ncan draw anything with ease before drawing the pixels on the embedded display.\n\nBased on [`embedded-graphics-core`] and [`embedded-graphics`]\n(see `transform` feature in [Crate features](#crate-features)).\n\nThis crate is `no_std` and it has 2 sets of canvases:\n\n- `Canvas` and `CanvasAt` - require `alloc` feature\n- `CCanvas` and `CCanvasAt` - do **not** require `alloc` feature because they\n   use const generics instead.\n\nThe main advantages of the canvases in this crate are:\n\n1. **Transparency** - pixels that haven't been drawn, won't override pixels on the display.\n\n![Example: Transparency](./examples/screenshots/transparency.png)\n\n_Example: Transparency - The canvas content (a circle) is drawn on the display where\nthere's already a drawn square._\n\n2. **Cropping** - The ability to crop leaves only the part of the canvas you want to\n  draw on the display. This is especially useful when you want to\n  partially show text, figures and images.\n\n![Example: Cropping text](./examples/screenshots/cropping_text.png)\n\n_Example: Cropping text - The full canvas content is drawn on the left and\nonly portion of it is cropped and drawn on the right._\n\n[crates-io]: https://img.shields.io/crates/v/embedded-canvas?logo=rust\u0026style=for-the-badge\n[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\n[sponsor-us]: https://img.shields.io/github/sponsors/LechevSpace?color=bf3989\u0026label=Sponsor%20us\u0026style=for-the-badge\u0026logoColor=bf3989\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgd2lkdGg9IjE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZmlsbD0iI2JmMzk4OSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNC4yNSAyLjVjLTEuMzM2IDAtMi43NSAxLjE2NC0yLjc1IDMgMCAyLjE1IDEuNTggNC4xNDQgMy4zNjUgNS42ODJBMjAuNTY1IDIwLjU2NSAwIDAwOCAxMy4zOTNhMjAuNTYxIDIwLjU2MSAwIDAwMy4xMzUtMi4yMTFDMTIuOTIgOS42NDQgMTQuNSA3LjY1IDE0LjUgNS41YzAtMS44MzYtMS40MTQtMy0yLjc1LTMtMS4zNzMgMC0yLjYwOS45ODYtMy4wMjkgMi40NTZhLjc1Ljc1IDAgMDEtMS40NDIgMEM2Ljg1OSAzLjQ4NiA1LjYyMyAyLjUgNC4yNSAyLjV6TTggMTQuMjVsLS4zNDUuNjY2LS4wMDItLjAwMS0uMDA2LS4wMDMtLjAxOC0uMDFhNy42NDMgNy42NDMgMCAwMS0uMzEtLjE3IDIyLjA3NSAyMi4wNzUgMCAwMS0zLjQzNC0yLjQxNEMyLjA0NSAxMC43MzEgMCA4LjM1IDAgNS41IDAgMi44MzYgMi4wODYgMSA0LjI1IDEgNS43OTcgMSA3LjE1MyAxLjgwMiA4IDMuMDIgOC44NDcgMS44MDIgMTAuMjAzIDEgMTEuNzUgMSAxMy45MTQgMSAxNiAyLjgzNiAxNiA1LjVjMCAyLjg1LTIuMDQ1IDUuMjMxLTMuODg1IDYuODE4YTIyLjA4IDIyLjA4IDAgMDEtMy43NDQgMi41ODRsLS4wMTguMDEtLjAwNi4wMDNoLS4wMDJMOCAxNC4yNXptMCAwbC4zNDUuNjY2YS43NTIuNzUyIDAgMDEtLjY5IDBMOCAxNC4yNXoiPjwvcGF0aD4KPC9zdmc%2BCg%3D%3D\n\n[`embedded-graphics`]: https://crates.io/crates/embedded-graphics\n[`embedded-graphics-core`]: https://crates.io/crates/embedded-graphics-core\n## How to work with canvases\n\nThere are **two** main canvases you can work with:\n\n### `Canvas` / `CCanavas`\n\nA canvas which you can draw on with origin `Point::zero()`.\nThe canvas location is not set for the provided display.\n\nAfter drawing decide where to place it on the display using the methods:\n- `Canvas::place_at(top_left: Point) -\u003e CanvasAt` (with `alloc` feature) or `CCanvas::place_at(top_left: Point) -\u003e CCanvasAt`\n- `Canvas::place_center(center: Point) -\u003e CanvasAt` (with `alloc` feature) or `CCanvas::place_center(center: Point) -\u003e CCanvasAt`\n\n### `CanvasAt` / `CCanvasAt`\n\n`CanvasAt`/`CCanvasAt` are a type of canvas ready to be drawn on the display at specified\nlocation (hence the name `CanvasAt`/`CCanvasAt`).\n\nThere are two ways of using `CanvasAt`/`CCanvasAt`:\n\n1. Directly placing the `CanvasAt`/`CCanavasAt` on specified location on the display and drawing inside.\n2. Create a `Canvas`/`CCanvas` and when ready to draw it on the display place the\n  `Canvas`/`CCanvas` at specified location using the methods:\n   - `Canvas::place_at(top_left: Point) -\u003e CanvasAt` (with `alloc` feature) and `CCanvas::place_at(top_left: Point) -\u003e CCanvasAt`\n   - `Canvas::place_center(center: Point) -\u003e CanvasAt` (with `alloc` feature) and `CCanvas::place_center(center: Point) -\u003e CCanvasAt`\n\n## Crate features\n- `default` features - `transform`\n- `alloc` - enables `Canvas` and `CanvasAt`.\n- `transform` - enables the trait implementation of [`embedded_graphics::transform::Transform`] for `CanvasAt`.\n\n\n[`embedded_graphics::transform::Transform`]: https://docs.rs/embedded-graphics/latest/embedded_graphics/transform/trait.Transform.html\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](./LICENSE-APACHE)\nor [MIT license](./LICENSE-MIT) at your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this project by you, as defined in the Apache-2.0 license,\nshall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechevspace%2Fembedded-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flechevspace%2Fembedded-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechevspace%2Fembedded-canvas/lists"}