Skip to main content

Interface: PaintCanvasOptions

Defined in: src/lib/classes/PaintCanvas/index.ts:259

Properties​

createCanvas?​

optional createCanvas?: CanvasFactory

Defined in: src/lib/classes/PaintCanvas/index.ts:279

Creates the canvases the engine draws in: layers, stroke buffers, masks and copies. Chosen by rendering unless given (replaceable for tests).


height?​

optional height?: number

Defined in: src/lib/classes/PaintCanvas/index.ts:263

Canvas height in pixels


layerStore?​

optional layerStore?: LayerStoreLike

Defined in: src/lib/classes/PaintCanvas/index.ts:287

Where to keep the user's layers so the drawing survives reloading the page (see useLayerStore)


maxCanvasSize?​

optional maxCanvasSize?: number

Defined in: src/lib/classes/PaintCanvas/index.ts:265

Largest canvas width or height allowed (default MAX_CANVAS_SIZE)


maxLayers?​

optional maxLayers?: number

Defined in: src/lib/classes/PaintCanvas/index.ts:267

Most layers the user can have (default DEFAULT_MAX_LAYERS)


names?​

optional names?: Partial<PaintCanvasNames>

Defined in: src/lib/classes/PaintCanvas/index.ts:285

Names to use instead of PaintCanvas's own (see DEFAULT_NAMES)


presetAuthor?​

optional presetAuthor?: () => AssetAuthor

Defined in: src/lib/classes/PaintCanvas/index.ts:283

Gives the author of presets made with newPreset (asked each time, so it can follow name changes)

Returns​

AssetAuthor


remoteDocumentStore?​

optional remoteDocumentStore?: DocumentStoreLike

Defined in: src/lib/classes/PaintCanvas/index.ts:289

Where to keep the whole drawing away from the browser, saved less often (see useRemoteDocumentStore)


rendering?​

optional rendering?: "cpu" | "gpu"

Defined in: src/lib/classes/PaintCanvas/index.ts:274

Where the canvases draw (cpu by default): cpu keeps their pixels in regular memory (createMemoryCanvas) so saving and copying don't stall phones; gpu asks the browser to keep them on the GPU (createOffscreenCanvas). Browsers fix this when a canvas is made, so it can't change while the canvas runs: to follow the user's choice (ui.data.rendering), pass the one they made last time (<paint-canvas> does this with its settings-store).


stores?​

optional stores?: AssetStores

Defined in: src/lib/classes/PaintCanvas/index.ts:281

Where the user's assets (brush presets, colour palettes, profile graphs) are kept (see useAssetStores)


systemClipboard?​

optional systemClipboard?: SystemClipboardLike | null

Defined in: src/lib/classes/PaintCanvas/index.ts:294

The system clipboard, which copying and cutting also put a PNG of the copied image data on so other apps (and brush shapes) can use it (the browser's by default; null for none)


width?​

optional width?: number

Defined in: src/lib/classes/PaintCanvas/index.ts:261

Canvas width in pixels