Canvas Toolkit
← Class index

CPaintEngine

Painting

Abstract low-level rendering interface used by {@link CPainter}. Concrete engines translate these operations to a particular drawing backend.

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

Declared members

abstract save(): void;

Saves the current rendering state.

abstract restore(): void;

Restores the most recently saved rendering state.

opacity(): number;

Returns opacity. Backends without transparency retain full opacity.

setOpacity(opacity: number): void;

Backends supporting transparency override this method.

abstract translate(x: number, y: number): void;

Translates the current coordinate system.

abstract fillRect(x: number, y: number, width: number, height: number): void;

Fills a rectangular area using the current fill style.

abstract strokeRect(x: number, y: number, width: number, height: number): void;

Strokes a rectangular area using the current stroke style.

abstract clearRect(x: number, y: number, width: number, height: number): void;

Clears a rectangular area.

abstract setFillStyle(style: string): void;

Sets the current fill style.

abstract setStrokeStyle(style: string): void;

Sets the current stroke style.

abstract setLineWidth(width: number): void;

Sets the current line width.

abstract textWidth(text: string): number;

Returns the rendered width of text using the current font.

abstract clipRect(x: number, y: number, width: number, height: number): void;

Intersects the current clipping region with a rectangle.

abstract font(): string;

Returns the current font specification.

abstract setFont(font: string): void;

Sets the current font specification.

abstract textAlign(): CanvasTextAlign;

Returns the current text alignment.

abstract setTextAlign(align: CanvasTextAlign): void;

Sets the current text alignment.

abstract setTextBaseline(baseline: CanvasTextBaseline): void;

Sets the current text baseline.

abstract textBaseline(): CanvasTextBaseline;

Returns the current text baseline.

abstract drawLine(x1: number, y1: number, x2: number, y2: number): void;

Draws a line segment.

abstract drawText(text: string, x: number, y: number): void;

Draws text at the specified position.

abstract drawPixmap(pixmap: CPixmap, x: number, y: number, w: number, h: number): void;

Draws a pixmap into the specified destination rectangle.

abstract drawEllipse(x: number, y: number, w: number, h: number): void;

Draws the outline of an ellipse.

abstract fillEllipse(x: number, y: number, w: number, h: number): void;

Fills an ellipse.

abstract drawRect(x: number, y: number, w: number, h: number): void;

Draws a rectangle using the current fill and stroke styles.

abstract drawRoundedRect(x: number, y: number, w: number, h: number, r: number | number[]): void;

Draws a rounded rectangle with the specified corner radius or radii.