Skip to content

Backend

Defined in: core/backend.ts:170

A renderer for a Scene, implemented per target (WebGL / Canvas / SVG).

readonly optional stylesNeedDrawables?: boolean

Defined in: core/backend.ts:193

Whether updateLayerStyles actually renders from its drawables argument (Canvas and SVG repaint from the vector view) vs. only stashing it for export (WebGL draws from the GPU flag/color tables). When false, the engine may omit drawables on hot paths. Absent ⇒ treated as true (safe default: always pass the vector view).


readonly optional supportsPassThrough?: boolean

Defined in: core/backend.ts:215

True if this backend supports pass-through (canvas/webgl yes, svg no).

optional appendToLayer(delta): void

Defined in: core/backend.ts:200

Append-only fast path (optional). Same observable result as a full re-upload, but the backend uploads/draws only the appended tail (delta) — O(new) instead of O(total). Backends that don’t implement it are driven via updateLayer (full re-upload); the engine still calls updateLayer for non-append changes.

RenderDelta

void


destroy(): void

Defined in: core/backend.ts:234

void


optional drawPassThrough(name, batch, mode): void

Defined in: core/backend.ts:211

Draw a batch into the layer’s accumulation buffer. mode: "replace-first" clears the layer’s buffer first (start of a full repaint), "replace-rest" continues a chunked full repaint without clearing, "append" draws on top (incremental).

string

DrawBatch

"replace-first" | "replace-rest" | "append"

void


optional removeInstancedLayer(name): void

Defined in: core/backend.ts:223

Remove an instanced primitive layer by name.

string

void


optional removePassThroughLayer(name): void

Defined in: core/backend.ts:204

Remove a pass-through layer.

string

void


render(): void

Defined in: core/backend.ts:231

void


resize(width, height): void

Defined in: core/backend.ts:230

Resize the rendering surface to a new CSS size (px). Re-reads the device pixel ratio and reconciles the backing buffer / framebuffers; the engine re-pushes layers and re-renders afterwards. A no-op when the size is unchanged.

number

number

void


optional setInstancedLayer(layer): void

Defined in: core/backend.ts:221

Register/replace a GPU-instanced primitive layer (the network rendering lane). Optional — only the WebGL backend implements it; other backends omit it, so network instanced rendering is WebGL-only (small-N / export go through the PathContext emitter).

InstancedLayer

void


setLayers(layers): void

Defined in: core/backend.ts:171

RenderLayer[]

void


optional setPassThroughLayer(layer): void

Defined in: core/backend.ts:202

Register/replace a pass-through layer (no buffers). Backends opt in.

PassThroughLayer

void


setTransform(t): void

Defined in: core/backend.ts:224

ViewTransform

void


optional snapshotPassThrough(): void

Defined in: core/backend.ts:213

Snapshot current accumulation for snapshot-pan (called on interaction start).

void


toPNG(): string

Defined in: core/backend.ts:232

string


toSVG(): string

Defined in: core/backend.ts:233

string


updateLayer(name, layer): void

Defined in: core/backend.ts:172

string

RenderLayer

void


optional updateLayerStyles(name, tables, drawables?): void

Defined in: core/backend.ts:186

Styles-only fast path (optional): the per-drawable color/flag tables changed but geometry did not (recolor / dim / show-hide). drawables is the refreshed vector view (same drawables, same order) so vector-reading consumers (Canvas redraw, SVG serialize, toSVG export) stay in sync with the raster output. Backends without it are driven through updateLayer (full re-upload).

drawables may be omitted (undefined): the caller does this on a backend that doesn’t render from the vector view (see stylesNeedDrawables) to skip an O(n) rebuild on a hot path (e.g. per-frame declutter). Such a backend must keep its previously-stored vector view; consumers that read it (e.g. toSVG) may then lag the tables until the next update that does pass drawables.

string

StyleTables

DrawableVector[]

void