CPainter
High-level painting interface that forwards drawing operations to a paint device.
import { CPainter } from "canvas-toolkit-lib";Declared members
constructor(device: CPaintDevice);Creates a painter for the specified paint device.
device(): CPaintDevice;Returns the paint device used by this painter.
save(): void;Saves the current painting state.
restore(): void;Restores the most recently saved painting state.
opacity(): number;Returns current drawing opacity, from zero to one.
setOpacity(opacity: number): void;Sets drawing opacity, clamped to zero through one; ignores non-finite values.
translate(x: number, y: number): void;Translates the current coordinate system.
clearRect(rect: CRect): void;Clears the specified rectangle.
fillRect(rect: CRect): void;Fills the specified rectangle.
strokeRect(rect: CRect): void;Strokes the specified rectangle.
setFillStyle(style: string): void;Sets the current fill style.
setStrokeStyle(style: string): void;Sets the current stroke style.
setLineWidth(width: number): void;Sets the current line width.
clipRect(rect: CRect): void;Intersects the clipping region with the specified rectangle.
textWidth(text: string): number;Returns the rendered width of text using the current font.
font(): CFont;Returns the current font specification.
setFont(font: CFont): void;Sets the current font specification.
textAlign(): CanvasTextAlign;Returns the current text alignment.
setTextAlign(align: CanvasTextAlign): void;Sets the current text alignment.
setTextBaseline(baseline: CanvasTextBaseline): void;Sets the current text baseline.
textBaseline(): CanvasTextBaseline;Returns the current text baseline.
drawLine(x1: number, y1: number, x2: number, y2: number): void;Draws a line segment.
drawText(text: string, x: number, y: number): void;Draws text at the specified position.
drawPixmap(pixmap: CPixmap, x: number, y: number, w?: number, h?: number): void;Draws a pixmap, using its dimensions by default.
drawEllipse(x: number, y: number, w: number, h: number): void;Draws the outline of an ellipse.
fillEllipse(x: number, y: number, w: number, h: number): void;Fills an ellipse.
setBrush(brush: string): void;Sets the brush used for filling shapes.
setPen(pen: string): void;Sets the pen used for stroking shapes.
drawRect(x: number, y: number, w: number, h: number): void;Draws a rectangle.
drawRoundedRect(x: number, y: number, w: number, h: number, r: number | number[]): void;Draws a rounded rectangle.