Canvas Toolkit
← Class index

CCanvasPaintDevice

Painting · extends CPaintDevice

Paint device backed by an HTML canvas element.

import { CCanvasPaintDevice } from "canvas-toolkit-lib";

Declared members

constructor(canvas: HTMLCanvasElement);

Creates a paint device for the specified canvas.

width(): number;

Returns the logical canvas width in CSS pixels.

height(): number;

Returns the logical canvas height in CSS pixels.

resize(width: number, height: number, pixelRatio?: number): boolean;

Synchronizes the backing bitmap without changing the CSS size.

canvas(): HTMLCanvasElement;

Returns the underlying HTML canvas element.

paintEngine(): CCanvasPaintEngine;

Returns the canvas paint engine used by this device.