CanvasBackend
Defined in: canvas/canvas-backend.ts:15
A renderer for a Scene, implemented per target (WebGL / Canvas / SVG).
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CanvasBackend(
canvas,width,height):CanvasBackend
Defined in: canvas/canvas-backend.ts:40
Parameters
Section titled “Parameters”canvas
Section titled “canvas”HTMLCanvasElement
number
height
Section titled “height”number
Returns
Section titled “Returns”CanvasBackend
Properties
Section titled “Properties”supportsPassThrough
Section titled “supportsPassThrough”
readonlysupportsPassThrough:true=true
Defined in: canvas/canvas-backend.ts:26
Canvas-2D persists drawn pixels between calls, so the canvas IS the pass-through accumulation buffer: points draw on top of the retained base map and stay there.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”appendToLayer()
Section titled “appendToLayer()”appendToLayer(
delta):void
Defined in: canvas/canvas-backend.ts:112
Incremental append (O(new)): accumulate the new drawables into the stored layer
(so a later full render() still draws everything), then draw ONLY those new
drawables on top — no clear. The clip (if any) is established ONCE and kept across
appends at a given transform, so each batch is just the new shapes — the canvas
analog of a GPU sub-buffer upload. Full redraws happen on transform/recolor/resize.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”destroy()
Section titled “destroy()”destroy():
void
Defined in: canvas/canvas-backend.ts:369
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”drawPassThrough()
Section titled “drawPassThrough()”drawPassThrough(
name,batch,mode):void
Defined in: canvas/canvas-backend.ts:178
Draw a batch of pass-through points onto the main canvas at the current transform.
"replace-first"starts a fresh full repaint of the overlay: drop any snapshot, redraw the retained base via the normal render(), then draw this batch on top."replace-rest"/"append"draw this batch on top of what’s already there (no clear) — continuing a chunked repaint, or an incremental add. (Single-batch draw; Task 7 time-slices large batches. No color grouping — YAGNI.)
Parameters
Section titled “Parameters”string
"replace-first" | "replace-rest" | "append"
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”removePassThroughLayer()
Section titled “removePassThroughLayer()”removePassThroughLayer(
name):void
Defined in: canvas/canvas-backend.ts:166
Remove a pass-through layer.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Backend.removePassThroughLayer
render()
Section titled “render()”render():
void
Defined in: canvas/canvas-backend.ts:141
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”resize()
Section titled “resize()”resize(
width,height):void
Defined in: canvas/canvas-backend.ts:64
Resize the CSS size + device-px backing store and re-read the dpr. Clears the canvas (setting canvas.width/height resets the bitmap and context state); the engine re-renders right after, which reapplies the view transform via setView.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setLayers()
Section titled “setLayers()”setLayers(
layers):void
Defined in: canvas/canvas-backend.ts:76
Parameters
Section titled “Parameters”layers
Section titled “layers”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setPassThroughLayer()
Section titled “setPassThroughLayer()”setPassThroughLayer(
layer):void
Defined in: canvas/canvas-backend.ts:162
Register/replace a pass-through layer (no buffers). Backends opt in.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setTransform()
Section titled “setTransform()”setTransform(
t):void
Defined in: canvas/canvas-backend.ts:100
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”snapshotPassThrough()
Section titled “snapshotPassThrough()”snapshotPassThrough():
void
Defined in: canvas/canvas-backend.ts:188
Capture the current canvas + transform so render() can snapshot-pan during a gesture.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”toPNG()
Section titled “toPNG()”toPNG():
string
Defined in: canvas/canvas-backend.ts:367
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”toSVG()
Section titled “toSVG()”toSVG():
string
Defined in: canvas/canvas-backend.ts:368
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”updateLayer()
Section titled “updateLayer()”updateLayer(
name,layer):void
Defined in: canvas/canvas-backend.ts:82
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”updateLayerStyles()
Section titled “updateLayerStyles()”updateLayerStyles(
name,_tables,drawables?):void
Defined in: canvas/canvas-backend.ts:93
Styles-only update: swap the stored vector view (the next render() repaints from it), so
Canvas always needs drawables (it renders from them — see stylesNeedDrawables,
left at its default). Visibility flags feed the clip silhouette, so drop the cached clip.
Parameters
Section titled “Parameters”string
_tables
Section titled “_tables”drawables?
Section titled “drawables?”Returns
Section titled “Returns”void