-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawer.ts
36 lines (22 loc) · 1.37 KB
/
drawer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { SimpleVector2 } from "../math";
import { RoundData, TextOptionsInterface } from "../types";
/**
* TODO:
* - clip background image
*/
export interface Drawer {
fillArc(x: number, y: number, w: number, h: number, color?: string): void;
strokeArc(x: number, y: number, w: number, h: number, color?: string, width?: number): void;
fillRect(x: number, y: number, w: number, h: number, color?: string): void;
strokeRect(x: number, y: number, w: number, h: number, color?: string, width?: number): void;
fillRoundedRect(x: number, y: number, w: number, h: number, round: RoundData, color?: string): void;
strokeRoundedRect(x: number, y: number, w: number, h: number, round: RoundData, color?: string, width?: number): void;
drawImage(image: CanvasImageSource, x: number, y: number, w?: number, h?: number): void;
drawPath(points: SimpleVector2[], color?: string, width?: number, close?: boolean): void;
fillPath(points: SimpleVector2[], color?: string, close?: boolean): void;
drawLine(x1: number, y1: number, x2: number, y2: number, color?: string, width?: number): void;
drawText(text: string, x: number, y: number, w: number, h: number, textOptions: TextOptionsInterface): void;
clear(resetTransform?: boolean): void;
startDrawingLine(x: number, y: number): void;
addPointToLine(x: number, y: number, stroke?: boolean): void;
}