Skip to content

DrawCommand

DrawCommand = { args: [string, number, number, number, number]; op: "fillRect"; } | { args: [string, number, number[], number[]]; op: "strokeLine"; } | { args: [string, number, number, number]; op: "fillArc"; } | { args: [string, string, string, number, number, string, string]; op: "fillText"; } | { args: PathSegment[]; op: "path"; } | { args: [string, PathSegment[]]; op: "fillPath"; } | { args: [string, number, PathSegment[]]; op: "strokePath"; }

Defined in: perf/offscreen.ts:40

Serialisable draw command — a small DSL for the chart’s draw pass that can be replayed on a regular CanvasRenderingContext2D or transferred (via postMessage) to an OffscreenCanvas worker. Charts that want offscreen rendering build a DrawCommand[] and feed it to OffscreenRenderer or executeCommands.