@obliczeniowo/elementary
Version:
Library made in Angular version 19
40 lines (39 loc) • 2.26 kB
TypeScript
import { Point2D, ColorType } from '@obliczeniowo/elementary/classes';
import { DrawingContextInterface, LinePattern, LinePatternDef, TextAlign, TextBaseline } from './drawing-context-interface';
export declare class DrawingCanvasInterface extends DrawingContextInterface {
ctx: CanvasRenderingContext2D;
protected _stroke: number;
get stroke(): number;
set stroke(value: number);
constructor(ctx: CanvasRenderingContext2D);
getTextDimension(text: string): {
width: number;
height: number;
};
clear(): void;
drawLine(startPoint: Point2D, endPoint: Point2D, stroke: number, color: ColorType, options?: any): this;
drawText(text: string, handlePosition: Point2D, color: ColorType, angle: number, options?: any): this;
drawPolyline(points: Point2D[], stroke: number, color: ColorType, options?: {
close?: boolean;
[key: string]: any;
}): this;
drawPolygon(points: Point2D[], stroke: number, color: ColorType | 'none', fill: ColorType | 'none', options?: {
close?: boolean;
[key: string]: any;
}): this;
drawCircle(point: Point2D, ray: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: any): this;
drawPie(center: Point2D, rx: number, ry: number, start: number, end: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: any): this;
drawEllipse(point: Point2D, xRay: number, yRay: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: any): this;
drawRect(x: number, y: number, width: number, height: number, stroke: number, strokeColor: ColorType, fillColor: ColorType, options?: any): this;
lineTo(point: Point2D, stroke: number, color: ColorType): this;
setFontSize(fontSize: number): this;
getFontSize(): number;
setTextAlign(align: TextAlign): this;
setTextBaseline(textBaseline: TextBaseline): this;
getTextWidth(text: string): number;
setLinePattern(linePattern: string | LinePattern | undefined, linePatternDef?: LinePatternDef): this;
getLineStrokeSize(size?: number): number;
transform(point: Point2D): Point2D;
save(fileName: string): void;
protected path(cb: () => void, fillOrStroke?: boolean): void;
}