canvas-display

Crates.iocanvas-display
lib.rscanvas-display
version0.1.2
sourcesrc
created_at2020-05-29 10:42:37.250618
updated_at2020-09-18 04:35:47.577891
descriptionWasm32 implementation for embedded-graphics https://github.com/jamwaffles/embedded-graphics DrawTarget. It is based on a HTML canvas.
homepage
repositoryhttps://codeberg.org/morph/canvas-display
max_upload_size
id247326
size28,368
Florian Blasius (FloVanGH)

documentation

https://docs.rs/canvas-display

README

canvas-display

MIT licensed crates.io docs.rs

Wasm32 implementation for embedded-graphics https://github.com/jamwaffles/embedded-graphics DrawTarget. It is based on a HTML canvas.

canvas-display

Usage

To include canvas-display in your project, add this dependency line to your Cargo.toml file:

canvas-display = "0.1.2"

To enable offscreen rendering, the crate provides a offscreen feature (no default feature). With this feature you have to call the flip method on CanvasDisplay after rendering.

Run examples

Requirements

Rust

canvas-display requires Rust 1.30 or newer.

wasm-pack

wasm-pack is required for building Rust-generated WebAssembly. Install it from https://rustwasm.github.io/wasm-pack/installer/.

npm

npm is a JavaScript package manger and is used to install and run a JavaScript bundler and development server. You could install npm from https://www.npmjs.com/get-npm.

For the examples we uses the latest version of npm. You could install it with this command:

npm install npm@latest -g

Run example

Navigate to directory of the example and run:

npm install

To serve the example locally run:

npm run serve

Navigate your Web browser to http://localhost:8080/

Build and run documentation

You can build and view the latest documentation by executing the following command:

cargo doc --no-deps --open
Commit count: 0

cargo fmt