Utility to render on a non displayed canvas and extract data from it.
// 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();
Inherit from ContainerOptions.
Name | Type | Default | Comment |
---|---|---|---|
fill | Color or String |
null |
Background color |
opacity | Number |
1 |
Global opacity |