Skip to main content

Function: drawScene()

drawScene(ctx, layers, view, pixelRatio, override?, area?): void

Defined in: src/lib/rendering/compositing/index.ts:161

Draw the visible part of the canvas onto the screen canvas: grey surround, white canvas, then all layers, positioned by the viewport.

Pixels stay sharp when zoomed in past 100% and are smoothed when zoomed out.

With an area, only the screen pixels showing that area of the canvas are redrawn (see screenArea), blending only that part of each layer, which is much quicker than redrawing everything while a stroke is drawn.

Parameters​

ctx​

DrawingContext

layers​

readonly DrawableLayer[]

view​

default

pixelRatio​

number

device pixels per CSS pixel (window.devicePixelRatio), for sharp drawing on high-resolution screens

override?​

LayerOverride

draw this image instead of one layer's canvas (the stroke preview)

area?​

Rect

redraw only this area of the canvas (canvas pixels)

Returns​

void