canvas-display 0.1.1

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

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.

Usage

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

canvas-display = { git = "https://codeberg.org/morph/canvas-display.git" }

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