Backend
Defined in: core/backend.ts:170
A renderer for a Scene, implemented per target (WebGL / Canvas / SVG).
Properties
Section titled “Properties”stylesNeedDrawables?
Section titled “stylesNeedDrawables?”
readonlyoptionalstylesNeedDrawables?: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).
supportsPassThrough?
Section titled “supportsPassThrough?”
readonlyoptionalsupportsPassThrough?:boolean
Defined in: core/backend.ts:215
True if this backend supports pass-through (canvas/webgl yes, svg no).
Methods
Section titled “Methods”appendToLayer()?
Section titled “appendToLayer()?”
optionalappendToLayer(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy():
void
Defined in: core/backend.ts:234
Returns
Section titled “Returns”void
drawPassThrough()?
Section titled “drawPassThrough()?”
optionaldrawPassThrough(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).
Parameters
Section titled “Parameters”string
"replace-first" | "replace-rest" | "append"
Returns
Section titled “Returns”void
removeInstancedLayer()?
Section titled “removeInstancedLayer()?”
optionalremoveInstancedLayer(name):void
Defined in: core/backend.ts:223
Remove an instanced primitive layer by name.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
removePassThroughLayer()?
Section titled “removePassThroughLayer()?”
optionalremovePassThroughLayer(name):void
Defined in: core/backend.ts:204
Remove a pass-through layer.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
render()
Section titled “render()”render():
void
Defined in: core/backend.ts:231
Returns
Section titled “Returns”void
resize()
Section titled “resize()”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.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”void
setInstancedLayer()?
Section titled “setInstancedLayer()?”
optionalsetInstancedLayer(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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
setLayers()
Section titled “setLayers()”setLayers(
layers):void
Defined in: core/backend.ts:171
Parameters
Section titled “Parameters”layers
Section titled “layers”Returns
Section titled “Returns”void
setPassThroughLayer()?
Section titled “setPassThroughLayer()?”
optionalsetPassThroughLayer(layer):void
Defined in: core/backend.ts:202
Register/replace a pass-through layer (no buffers). Backends opt in.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
setTransform()
Section titled “setTransform()”setTransform(
t):void
Defined in: core/backend.ts:224
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
snapshotPassThrough()?
Section titled “snapshotPassThrough()?”
optionalsnapshotPassThrough():void
Defined in: core/backend.ts:213
Snapshot current accumulation for snapshot-pan (called on interaction start).
Returns
Section titled “Returns”void
toPNG()
Section titled “toPNG()”toPNG():
string
Defined in: core/backend.ts:232
Returns
Section titled “Returns”string
toSVG()
Section titled “toSVG()”toSVG():
string
Defined in: core/backend.ts:233
Returns
Section titled “Returns”string
updateLayer()
Section titled “updateLayer()”updateLayer(
name,layer):void
Defined in: core/backend.ts:172
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
updateLayerStyles()?
Section titled “updateLayerStyles()?”
optionalupdateLayerStyles(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.
Parameters
Section titled “Parameters”string
tables
Section titled “tables”drawables?
Section titled “drawables?”Returns
Section titled “Returns”void