-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame.d.ts
167 lines (120 loc) · 3.98 KB
/
frame.d.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/// <reference path="./animation.d.ts"/>
import { FrameGenerator, RenderingContext2D, ShapeRenderer, Font, Color } from "./animation";
interface IShape extends FrameGenerator {
color: Color;
outline: boolean;
outlineWidth: number;
hidden: boolean;
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}
export class Circle implements IShape {
x: number;
y: number;
r: number;
color: Color;
outline: boolean;
outlineWidth: number;
hidden: boolean;
constructor(x: number, y: number, r: number, color?: Color);
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}
export class Ellipse implements IShape {
x: number;
y: number;
r: number;
rx: number;
ry: number;
rotation: number;
startAngle: number;
endAngle: number;
counterClockwise: boolean;
color: Color;
outline: boolean;
outlineWidth: number;
hidden: boolean;
constructor(x: number, y: number, rx: number, ry?: number, color?: Color);
SortAngles(): void;
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}
export class Rect implements IShape {
x: number;
y: number;
w: number;
h: number;
color: Color;
outline: boolean;
outlineWidth: number;
hidden: boolean;
get x1(): number; set x1(x1: number);
get y1(): number; set y1(y1: number);
get x2(): number; set x2(x2: number);
get y2(): number; set y2(y2: number);
constructor(x: number, y: number, w: number, h: number, color?: Color);
/** Returns a bbox where w and h are always >= 0 */
GetBBox(): {x: number, y: number, w: number, h: number};
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}
export class Text implements IShape {
text: string;
x: number;
y: number;
color: Color;
font: Font;
outline: boolean;
outlineWidth: number;
outlineAsBorder: boolean;
borderColor: Color;
hidden: boolean;
constructor(text: string, x: number, y: number, color?: Color);
/** Reverts changes made to the context before returning. */
Measure(ctx: RenderingContext2D): TextMetrics;
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}
export class ImageSource implements IShape {
// HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame
source: CanvasImageSource;
x: number;
y: number;
width: number;
height: number;
aspectRatio: number;
cropLeft: number;
cropRight: number;
cropTop: number;
cropBottom: number;
/** Whether to use {@link ImageSource.color} as a placeholder while the source is loading. */
staticPlaceholder: boolean;
color: Color;
/** The color of the outline is {@link ImageSource.color}. */
outline: boolean;
outlineWidth: number;
hidden: boolean;
get sourceWidth(): number;
get sourceHeight(): number;
get sourceAspectRatio(): number;
get cropWidth(): number;
get cropHeight(): number;
get desiredAspectRatio(): number;
get actualWidth(): number;
get actualHeight(): number;
/** True when the current frame of an Image or Video element is ready. */
get loaded(): boolean;
constructor(source: CanvasImageSource, x?: number, y?: number, color?: Color);
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
static FromImageUrl(url: string, x?: number, y?: number, color?: Color): ImageSource;
static FromVideoUrl(url: string, x?: number, y?: number, color?: Color, muted?: boolean): ImageSource;
}
export class FrameView implements FrameGenerator {
hidden: boolean;
constructor();
Add<T extends FrameGenerator>(shape: T): T;
Remove(shape: FrameGenerator): boolean;
Draw(ctx: RenderingContext2D): void;
[Symbol.iterator](): Iterator<ShapeRenderer>;
}