Skip to content

OffScreenCanvas ​

Utility to render on a non displayed canvas and extract data from it.

Examples ​

js
// This will override the native OffscreenCanvas class !
import { OffScreenCanvas, Circle } from "pencil.js";

const offScreen = new OffScreenCanvas(width, height);
offScreen.add(new Circle([0, 0], radius));

const imageData = offScreen.getImageData();

OffscreenCanvasOptions ​

Inherit from ContainerOptions.

NameTypeDefaultComment
fillColor or StringnullBackground color
opacityNumber1Global opacity

Released under the MIT License.