@girs/gjs 4.0.0-beta.3 → 4.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cairo.d.ts +840 -3
- package/console.d.ts +21 -0
- package/console.js +6 -0
- package/dom.d.ts +51 -63
- package/gettext.d.ts +28 -29
- package/gjs-ambient.d.ts +25 -0
- package/gjs.d.ts +376 -103
- package/index.d.ts +13 -0
- package/index.js +5 -0
- package/package.json +20 -9
- package/system.d.ts +31 -32
- package/tsconfig.json +5 -3
- package/ambient.d.ts +0 -20
- /package/{ambient.js → gjs-ambient.js} +0 -0
package/cairo.d.ts
CHANGED
|
@@ -1,6 +1,843 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// Cairo 1.0
|
|
2
|
+
import Cairo from '@girs/cairo-1.0';
|
|
3
|
+
import type GObject from '@girs/gobject-2.0';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
declare namespace giCairo {
|
|
6
|
+
// Re-export enums directly from Cairo
|
|
7
|
+
export import Status = Cairo.Status;
|
|
8
|
+
export import Content = Cairo.Content;
|
|
9
|
+
export import Operator = Cairo.Operator;
|
|
10
|
+
export import Antialias = Cairo.Antialias;
|
|
11
|
+
export import FillRule = Cairo.FillRule;
|
|
12
|
+
export import LineCap = Cairo.LineCap;
|
|
13
|
+
export import LineJoin = Cairo.LineJoin;
|
|
14
|
+
export import TextClusterFlags = Cairo.TextClusterFlags;
|
|
15
|
+
export import FontSlant = Cairo.FontSlant;
|
|
16
|
+
export import FontWeight = Cairo.FontWeight;
|
|
17
|
+
export import SubpixelOrder = Cairo.SubpixelOrder;
|
|
18
|
+
export import HintStyle = Cairo.HintStyle;
|
|
19
|
+
export import HintMetrics = Cairo.HintMetrics;
|
|
20
|
+
export import FontType = Cairo.FontType;
|
|
21
|
+
export import PathDataType = Cairo.PathDataType;
|
|
22
|
+
export import DeviceType = Cairo.DeviceType;
|
|
23
|
+
export import SurfaceType = Cairo.SurfaceType;
|
|
24
|
+
export import Format = Cairo.Format;
|
|
25
|
+
export import PatternType = Cairo.PatternType;
|
|
26
|
+
export import Extend = Cairo.Extend;
|
|
27
|
+
export import Filter = Cairo.Filter;
|
|
28
|
+
export import RegionOverlap = Cairo.RegionOverlap;
|
|
5
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Describes the metrics of a string of text
|
|
32
|
+
*/
|
|
33
|
+
export interface TextExtents {
|
|
34
|
+
/** The horizontal distance from the origin to the leftmost part of the text */
|
|
35
|
+
xBearing: number;
|
|
36
|
+
/** The vertical distance from the origin to the topmost part of the text */
|
|
37
|
+
yBearing: number;
|
|
38
|
+
/** The width of the text */
|
|
39
|
+
width: number;
|
|
40
|
+
/** The height of the text */
|
|
41
|
+
height: number;
|
|
42
|
+
/** The distance to advance horizontally after drawing the text */
|
|
43
|
+
xAdvance: number;
|
|
44
|
+
/** The distance to advance vertically after drawing the text */
|
|
45
|
+
yAdvance: number;
|
|
46
|
+
}
|
|
6
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The main Cairo drawing context
|
|
50
|
+
*
|
|
51
|
+
* A Cairo context is used to draw to surfaces and perform drawing operations.
|
|
52
|
+
* When you're done with a context, you must call $dispose() to free memory.
|
|
53
|
+
*/
|
|
54
|
+
export class Context extends Cairo.Context {
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new Cairo context for drawing to the given surface
|
|
57
|
+
* @param surface The surface to draw on
|
|
58
|
+
*/
|
|
59
|
+
constructor(surface: Surface);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Free a Cairo.Context and all associated memory
|
|
63
|
+
*
|
|
64
|
+
* Unlike other objects in GJS, Cairo contexts must be explicitly disposed
|
|
65
|
+
* to avoid memory leaks.
|
|
66
|
+
*/
|
|
67
|
+
$dispose(): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Adds a circular arc of the given radius to the current path
|
|
71
|
+
* @param xc X coordinate of the center of the arc
|
|
72
|
+
* @param yc Y coordinate of the center of the arc
|
|
73
|
+
* @param radius Radius of the arc
|
|
74
|
+
* @param angle1 Starting angle in radians
|
|
75
|
+
* @param angle2 End angle in radians
|
|
76
|
+
*/
|
|
77
|
+
arc(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Adds a circular arc of the given radius to the current path, but draws
|
|
81
|
+
* the arc in the opposite direction from arc()
|
|
82
|
+
* @param xc X coordinate of the center of the arc
|
|
83
|
+
* @param yc Y coordinate of the center of the arc
|
|
84
|
+
* @param radius Radius of the arc
|
|
85
|
+
* @param angle1 Starting angle in radians
|
|
86
|
+
* @param angle2 End angle in radians
|
|
87
|
+
*/
|
|
88
|
+
arcNegative(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Adds a cubic Bézier spline to the current path
|
|
92
|
+
* @param x1 X coordinate of the first control point
|
|
93
|
+
* @param y1 Y coordinate of the first control point
|
|
94
|
+
* @param x2 X coordinate of the second control point
|
|
95
|
+
* @param y2 Y coordinate of the second control point
|
|
96
|
+
* @param x3 X coordinate of the end point
|
|
97
|
+
* @param y3 Y coordinate of the end point
|
|
98
|
+
*/
|
|
99
|
+
curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Establishes a new clip region by intersecting the current clip region
|
|
103
|
+
* with the current path, then clearing the current path
|
|
104
|
+
*/
|
|
105
|
+
clip(): void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Like clip() but preserves the current path
|
|
109
|
+
*/
|
|
110
|
+
clipPreserve(): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Returns the current clip extents as [x1, y1, x2, y2]
|
|
114
|
+
* @returns An array with [x1, y1, x2, y2] clip extents
|
|
115
|
+
*/
|
|
116
|
+
clipExtents(): [number, number, number, number];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Closes the current path by drawing a line to the beginning of the current subpath
|
|
120
|
+
*/
|
|
121
|
+
closePath(): void;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Emits the current page, but doesn't clear it
|
|
125
|
+
*/
|
|
126
|
+
copyPage(): void;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Transforms a coordinate from device space to user space
|
|
130
|
+
* @param x X coordinate
|
|
131
|
+
* @param y Y coordinate
|
|
132
|
+
* @returns An array with [x, y] transformed coordinates
|
|
133
|
+
*/
|
|
134
|
+
deviceToUser(x: number, y: number): [number, number];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Transforms a distance vector from device space to user space
|
|
138
|
+
* @param x X component of the distance vector
|
|
139
|
+
* @param y Y component of the distance vector
|
|
140
|
+
* @returns An array with [x, y] transformed distance vector
|
|
141
|
+
*/
|
|
142
|
+
deviceToUserDistance(x: number, y: number): [number, number];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Fills the current path using the current fill rule, then clears the path
|
|
146
|
+
*/
|
|
147
|
+
fill(): void;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Fills the current path using the current fill rule, but doesn't clear the path
|
|
151
|
+
*/
|
|
152
|
+
fillPreserve(): void;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Returns the current fill extents as [x1, y1, x2, y2]
|
|
156
|
+
* @returns An array with [x1, y1, x2, y2] fill extents
|
|
157
|
+
*/
|
|
158
|
+
fillExtents(): [number, number, number, number];
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Gets the current antialiasing mode
|
|
162
|
+
* @returns The current antialiasing mode
|
|
163
|
+
*/
|
|
164
|
+
getAntialias(): Antialias;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Gets the current point of the current path
|
|
168
|
+
* @returns An array with [x, y] coordinates of the current point
|
|
169
|
+
*/
|
|
170
|
+
getCurrentPoint(): [number, number];
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Gets the current dash count
|
|
174
|
+
* @returns The number of elements in the current dash pattern
|
|
175
|
+
*/
|
|
176
|
+
getDashCount(): number;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Gets the current fill rule
|
|
180
|
+
* @returns The current fill rule
|
|
181
|
+
*/
|
|
182
|
+
getFillRule(): FillRule;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Gets the current line cap style
|
|
186
|
+
* @returns The current line cap style
|
|
187
|
+
*/
|
|
188
|
+
getLineCap(): LineCap;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Gets the current line join style
|
|
192
|
+
* @returns The current line join style
|
|
193
|
+
*/
|
|
194
|
+
getLineJoin(): LineJoin;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Gets the current line width
|
|
198
|
+
* @returns The current line width
|
|
199
|
+
*/
|
|
200
|
+
getLineWidth(): number;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Gets the current miter limit
|
|
204
|
+
* @returns The current miter limit
|
|
205
|
+
*/
|
|
206
|
+
getMiterLimit(): number;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Gets the current compositing operator
|
|
210
|
+
* @returns The current compositing operator
|
|
211
|
+
*/
|
|
212
|
+
getOperator(): Operator;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Gets the current source pattern
|
|
216
|
+
* @returns The current source pattern
|
|
217
|
+
*/
|
|
218
|
+
getSource(): Pattern;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Gets the surface the Cairo context is drawing on
|
|
222
|
+
* @returns The target surface
|
|
223
|
+
*/
|
|
224
|
+
getTarget(): Surface;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Gets the current tolerance value
|
|
228
|
+
* @returns The current tolerance value
|
|
229
|
+
*/
|
|
230
|
+
getTolerance(): number;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Checks if there is a current point defined
|
|
234
|
+
* @returns True if there is a current point
|
|
235
|
+
*/
|
|
236
|
+
hasCurrentPoint(): boolean;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Resets the current transformation matrix to the identity matrix
|
|
240
|
+
*/
|
|
241
|
+
identityMatrix(): void;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Tests whether the given point is inside the area filled by the current path
|
|
245
|
+
* @param x X coordinate of the point to test
|
|
246
|
+
* @param y Y coordinate of the point to test
|
|
247
|
+
* @returns True if the point is inside the path
|
|
248
|
+
*/
|
|
249
|
+
inFill(x: number, y: number): boolean;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Tests whether the given point is inside the area that would be inked
|
|
253
|
+
* by the current path with the current line width and stroke parameters
|
|
254
|
+
* @param x X coordinate of the point to test
|
|
255
|
+
* @param y Y coordinate of the point to test
|
|
256
|
+
* @returns True if the point would be inked
|
|
257
|
+
*/
|
|
258
|
+
inStroke(x: number, y: number): boolean;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Adds a line to the current path from the current point to the given point
|
|
262
|
+
* @param x X coordinate of the end point
|
|
263
|
+
* @param y Y coordinate of the end point
|
|
264
|
+
*/
|
|
265
|
+
lineTo(x: number, y: number): void;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Sets the current mask pattern used for painting operations
|
|
269
|
+
* @param pattern A pattern to use as mask
|
|
270
|
+
*/
|
|
271
|
+
mask(pattern: Pattern): void;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Sets the current mask to a surface
|
|
275
|
+
* @param surface A surface to use as mask
|
|
276
|
+
* @param x X coordinate at which to place the origin of the surface
|
|
277
|
+
* @param y Y coordinate at which to place the origin of the surface
|
|
278
|
+
*/
|
|
279
|
+
maskSurface(surface: Surface, x: number, y: number): void;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Begins a new subpath at the given point
|
|
283
|
+
* @param x X coordinate of the new position
|
|
284
|
+
* @param y Y coordinate of the new position
|
|
285
|
+
*/
|
|
286
|
+
moveTo(x: number, y: number): void;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Clears the current path and begins a new path
|
|
290
|
+
*/
|
|
291
|
+
newPath(): void;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Begins a new subpath without changing the current point
|
|
295
|
+
*/
|
|
296
|
+
newSubPath(): void;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Paints the current source everywhere within the current clip region
|
|
300
|
+
*/
|
|
301
|
+
paint(): void;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Paints the current source everywhere within the current clip region
|
|
305
|
+
* using the given alpha value
|
|
306
|
+
* @param alpha Alpha value to use, between 0 and 1
|
|
307
|
+
*/
|
|
308
|
+
paintWithAlpha(alpha: number): void;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Returns the current path extents as [x1, y1, x2, y2]
|
|
312
|
+
* @returns An array with [x1, y1, x2, y2] path extents
|
|
313
|
+
*/
|
|
314
|
+
pathExtents(): [number, number, number, number];
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Terminates the current pattern group and returns a new pattern
|
|
318
|
+
* representing everything drawn to the group
|
|
319
|
+
* @returns A new pattern representing the group
|
|
320
|
+
*/
|
|
321
|
+
popGroup(): Pattern;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Terminates the current pattern group and makes it the current source pattern
|
|
325
|
+
*/
|
|
326
|
+
popGroupToSource(): void;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Temporarily redirects drawing to an intermediate surface
|
|
330
|
+
*/
|
|
331
|
+
pushGroup(): void;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Temporarily redirects drawing to an intermediate surface with the given content
|
|
335
|
+
* @param content The content type for the group
|
|
336
|
+
*/
|
|
337
|
+
pushGroupWithContent(content: Content): void;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Adds a rectangle to the current path
|
|
341
|
+
* @param x X coordinate of the top-left corner
|
|
342
|
+
* @param y Y coordinate of the top-left corner
|
|
343
|
+
* @param width Width of the rectangle
|
|
344
|
+
* @param height Height of the rectangle
|
|
345
|
+
*/
|
|
346
|
+
rectangle(x: number, y: number, width: number, height: number): void;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Adds a cubic Bézier spline to the current path using relative coordinates
|
|
350
|
+
* @param dx1 X offset to the first control point from current point
|
|
351
|
+
* @param dy1 Y offset to the first control point from current point
|
|
352
|
+
* @param dx2 X offset to the second control point from current point
|
|
353
|
+
* @param dy2 Y offset to the second control point from current point
|
|
354
|
+
* @param dx3 X offset to the end point from current point
|
|
355
|
+
* @param dy3 Y offset to the end point from current point
|
|
356
|
+
*/
|
|
357
|
+
relCurveTo(dx1: number, dy1: number, dx2: number, dy2: number, dx3: number, dy3: number): void;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Adds a line to the current path relative to the current point
|
|
361
|
+
* @param dx X offset from the current point
|
|
362
|
+
* @param dy Y offset from the current point
|
|
363
|
+
*/
|
|
364
|
+
relLineTo(dx: number, dy: number): void;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Begins a new subpath relative to the current point
|
|
368
|
+
* @param dx X offset from the current point
|
|
369
|
+
* @param dy Y offset from the current point
|
|
370
|
+
*/
|
|
371
|
+
relMoveTo(dx: number, dy: number): void;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Resets the current clip region to its original, unrestricted state
|
|
375
|
+
*/
|
|
376
|
+
resetClip(): void;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Restores the context state from the stack
|
|
380
|
+
*/
|
|
381
|
+
restore(): void;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Rotates the current transformation matrix
|
|
385
|
+
* @param angle Angle of rotation in radians
|
|
386
|
+
*/
|
|
387
|
+
rotate(angle: number): void;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Saves the current context state to the stack
|
|
391
|
+
*/
|
|
392
|
+
save(): void;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Scales the current transformation matrix
|
|
396
|
+
* @param sx Scale factor for the X dimension
|
|
397
|
+
* @param sy Scale factor for the Y dimension
|
|
398
|
+
*/
|
|
399
|
+
scale(sx: number, sy: number): void;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Selects a font face
|
|
403
|
+
* @param family A font family name
|
|
404
|
+
* @param slant A font slant
|
|
405
|
+
* @param weight A font weight
|
|
406
|
+
*/
|
|
407
|
+
selectFontFace(family: string, slant: number, weight: number): void;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Sets the antialiasing mode
|
|
411
|
+
* @param antialias The new antialiasing mode
|
|
412
|
+
*/
|
|
413
|
+
setAntialias(antialias: Antialias): void;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Sets the dash pattern to be used by stroke()
|
|
417
|
+
* @param dashes Array of dash lengths
|
|
418
|
+
* @param offset Offset into the dash pattern
|
|
419
|
+
*/
|
|
420
|
+
setDash(dashes: number[], offset: number): void;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Sets the current font size in user space units
|
|
424
|
+
* @param size Font size in user space units
|
|
425
|
+
*/
|
|
426
|
+
setFontSize(size: number): void;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Sets the current fill rule
|
|
430
|
+
* @param fillRule The new fill rule
|
|
431
|
+
*/
|
|
432
|
+
setFillRule(fillRule: FillRule): void;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Sets the current line cap style
|
|
436
|
+
* @param lineCap The new line cap style
|
|
437
|
+
*/
|
|
438
|
+
setLineCap(lineCap: LineCap): void;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Sets the current line join style
|
|
442
|
+
* @param lineJoin The new line join style
|
|
443
|
+
*/
|
|
444
|
+
setLineJoin(lineJoin: LineJoin): void;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Sets the current line width
|
|
448
|
+
* @param width The new line width
|
|
449
|
+
*/
|
|
450
|
+
setLineWidth(width: number): void;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Sets the current miter limit
|
|
454
|
+
* @param limit The new miter limit
|
|
455
|
+
*/
|
|
456
|
+
setMiterLimit(limit: number): void;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Sets the current compositing operator
|
|
460
|
+
* @param op The new compositing operator
|
|
461
|
+
*/
|
|
462
|
+
setOperator(op: Operator): void;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Sets the current source pattern
|
|
466
|
+
* @param pattern The new source pattern
|
|
467
|
+
*/
|
|
468
|
+
setSource(pattern: Pattern): void;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Sets the source pattern to an RGB opaque color
|
|
472
|
+
* @param red Red component, between 0 and 1
|
|
473
|
+
* @param green Green component, between 0 and 1
|
|
474
|
+
* @param blue Blue component, between 0 and 1
|
|
475
|
+
*/
|
|
476
|
+
setSourceRGB(red: number, green: number, blue: number): void;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Sets the source pattern to an RGBA color
|
|
480
|
+
* @param red Red component, between 0 and 1
|
|
481
|
+
* @param green Green component, between 0 and 1
|
|
482
|
+
* @param blue Blue component, between 0 and 1
|
|
483
|
+
* @param alpha Alpha component, between 0 and 1
|
|
484
|
+
*/
|
|
485
|
+
setSourceRGBA(red: number, green: number, blue: number, alpha: number): void;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Sets the source pattern to the given surface
|
|
489
|
+
* @param surface The new source surface
|
|
490
|
+
* @param x X coordinate where to place the surface origin
|
|
491
|
+
* @param y Y coordinate where to place the surface origin
|
|
492
|
+
*/
|
|
493
|
+
setSourceSurface(surface: Surface, x: number, y: number): void;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Sets the tolerance used when converting paths to trapezoids
|
|
497
|
+
* @param tolerance The new tolerance value
|
|
498
|
+
*/
|
|
499
|
+
setTolerance(tolerance: number): void;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Emits the current page and clears it
|
|
503
|
+
*/
|
|
504
|
+
showPage(): void;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Draws text at the current position
|
|
508
|
+
* @param utf8 A string of text encoded in UTF-8
|
|
509
|
+
*/
|
|
510
|
+
showText(utf8: string): void;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Strokes the current path using the current line width, line join,
|
|
514
|
+
* line cap, and dash settings, then clears the path
|
|
515
|
+
*/
|
|
516
|
+
stroke(): void;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Like stroke() but preserves the current path
|
|
520
|
+
*/
|
|
521
|
+
strokePreserve(): void;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Returns the current stroke extents as [x1, y1, x2, y2]
|
|
525
|
+
* @returns An array with [x1, y1, x2, y2] stroke extents
|
|
526
|
+
*/
|
|
527
|
+
strokeExtents(): [number, number, number, number];
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Gets the extents of the given text if it were drawn at the current point
|
|
531
|
+
* @param utf8 A string of text encoded in UTF-8
|
|
532
|
+
* @returns Text extents information
|
|
533
|
+
*/
|
|
534
|
+
textExtents(utf8: string): TextExtents;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Translates the current transformation matrix
|
|
538
|
+
* @param tx Translation in the X direction
|
|
539
|
+
* @param ty Translation in the Y direction
|
|
540
|
+
*/
|
|
541
|
+
translate(tx: number, ty: number): void;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Transforms a coordinate from user space to device space
|
|
545
|
+
* @param x X coordinate
|
|
546
|
+
* @param y Y coordinate
|
|
547
|
+
* @returns An array with [x, y] transformed coordinates
|
|
548
|
+
*/
|
|
549
|
+
userToDevice(x: number, y: number): [number, number];
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Transforms a distance vector from user space to device space
|
|
553
|
+
* @param x X component of the distance vector
|
|
554
|
+
* @param y Y component of the distance vector
|
|
555
|
+
* @returns An array with [x, y] transformed distance vector
|
|
556
|
+
*/
|
|
557
|
+
userToDeviceDistance(x: number, y: number): [number, number];
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Creates a copy of the current path and returns it
|
|
561
|
+
* @returns A copy of the current path
|
|
562
|
+
*/
|
|
563
|
+
copyPath(): Path;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Appends a path to the current path
|
|
567
|
+
* @param path A path to append
|
|
568
|
+
*/
|
|
569
|
+
appendPath(path: Path): void;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Base class for all Cairo surfaces
|
|
574
|
+
*/
|
|
575
|
+
export abstract class Surface extends Cairo.Surface {
|
|
576
|
+
/**
|
|
577
|
+
* Gets the device scale of the surface
|
|
578
|
+
* @returns An array with [x, y] device scale
|
|
579
|
+
*/
|
|
580
|
+
getDeviceScale(): [number, number];
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Sets the device scale of the surface
|
|
584
|
+
* @param x X scale factor
|
|
585
|
+
* @param y Y scale factor
|
|
586
|
+
*/
|
|
587
|
+
setDeviceScale(x: number, y: number): void;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Gets the device offset of the surface
|
|
591
|
+
* @returns An array with [x, y] device offset
|
|
592
|
+
*/
|
|
593
|
+
getDeviceOffset(): [number, number];
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Sets the device offset of the surface
|
|
597
|
+
* @param x X offset
|
|
598
|
+
* @param y Y offset
|
|
599
|
+
*/
|
|
600
|
+
setDeviceOffset(x: number, y: number): void;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Performs all pending drawing operations
|
|
604
|
+
*/
|
|
605
|
+
flush(): void;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Finishes the surface and drops all references to external resources
|
|
609
|
+
*/
|
|
610
|
+
finish(): void;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* A surface that uses in-memory image data buffers
|
|
615
|
+
*/
|
|
616
|
+
export class ImageSurface extends Surface {
|
|
617
|
+
/**
|
|
618
|
+
* Creates a new image surface
|
|
619
|
+
* @param format The format of pixels in the surface
|
|
620
|
+
* @param width Width of the surface in pixels
|
|
621
|
+
* @param height Height of the surface in pixels
|
|
622
|
+
*/
|
|
623
|
+
constructor(format: Format, width: number, height: number);
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Creates a new image surface from a PNG file
|
|
627
|
+
* @param filename Path to a PNG file
|
|
628
|
+
* @returns A new image surface
|
|
629
|
+
*/
|
|
630
|
+
static createFromPNG(filename: string): ImageSurface;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Gets the format of the surface
|
|
634
|
+
* @returns The format of the surface
|
|
635
|
+
*/
|
|
636
|
+
getFormat(): Format;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Gets the width of the surface in pixels
|
|
640
|
+
* @returns The width of the surface
|
|
641
|
+
*/
|
|
642
|
+
getWidth(): number;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Gets the height of the surface in pixels
|
|
646
|
+
* @returns The height of the surface
|
|
647
|
+
*/
|
|
648
|
+
getHeight(): number;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Writes the contents of the surface to a PNG file
|
|
652
|
+
* @param filename Path to the PNG file to write
|
|
653
|
+
*/
|
|
654
|
+
writeToPNG(filename: string): void;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* A surface that produces output in the PDF format
|
|
659
|
+
*/
|
|
660
|
+
export class PDFSurface extends Surface {
|
|
661
|
+
/**
|
|
662
|
+
* Creates a new PDF surface
|
|
663
|
+
* @param filename Path to the PDF file to write to
|
|
664
|
+
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
665
|
+
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
666
|
+
*/
|
|
667
|
+
constructor(filename: string, width: number, height: number);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* A surface that produces output in the PostScript format
|
|
672
|
+
*/
|
|
673
|
+
export class PSSurface extends Surface {
|
|
674
|
+
/**
|
|
675
|
+
* Creates a new PostScript surface
|
|
676
|
+
* @param filename Path to the PostScript file to write to
|
|
677
|
+
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
678
|
+
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
679
|
+
*/
|
|
680
|
+
constructor(filename: string, width: number, height: number);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* A surface that produces output in the SVG format
|
|
685
|
+
*/
|
|
686
|
+
export class SVGSurface extends Surface {
|
|
687
|
+
/**
|
|
688
|
+
* Creates a new SVG surface
|
|
689
|
+
* @param filename Path to the SVG file to write to
|
|
690
|
+
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
691
|
+
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
692
|
+
*/
|
|
693
|
+
constructor(filename: string, width: number, height: number);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Base class for all Cairo patterns
|
|
698
|
+
*/
|
|
699
|
+
export class Pattern extends Cairo.Pattern {}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Base class for all gradient patterns
|
|
703
|
+
*/
|
|
704
|
+
export class Gradient extends Pattern {
|
|
705
|
+
/**
|
|
706
|
+
* Adds a color stop to the gradient at the given offset
|
|
707
|
+
* @param offset Offset position of the stop, between 0 and 1
|
|
708
|
+
* @param red Red component, between 0 and 1
|
|
709
|
+
* @param green Green component, between 0 and 1
|
|
710
|
+
* @param blue Blue component, between 0 and 1
|
|
711
|
+
* @param alpha Alpha component, between 0 and 1
|
|
712
|
+
*/
|
|
713
|
+
addColorStopRGBA(offset: number, red: number, green: number, blue: number, alpha: number): void;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Adds an opaque color stop to the gradient at the given offset
|
|
717
|
+
* @param offset Offset position of the stop, between 0 and 1
|
|
718
|
+
* @param red Red component, between 0 and 1
|
|
719
|
+
* @param green Green component, between 0 and 1
|
|
720
|
+
* @param blue Blue component, between 0 and 1
|
|
721
|
+
*/
|
|
722
|
+
addColorStopRGB(offset: number, red: number, green: number, blue: number): void;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* A pattern for linear gradients
|
|
727
|
+
*/
|
|
728
|
+
export class LinearGradient extends Gradient {
|
|
729
|
+
/**
|
|
730
|
+
* Creates a new linear gradient pattern
|
|
731
|
+
* @param x0 X coordinate of the start point
|
|
732
|
+
* @param y0 Y coordinate of the start point
|
|
733
|
+
* @param x1 X coordinate of the end point
|
|
734
|
+
* @param y1 Y coordinate of the end point
|
|
735
|
+
*/
|
|
736
|
+
constructor(x0: number, y0: number, x1: number, y1: number);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* A pattern for radial gradients
|
|
741
|
+
*/
|
|
742
|
+
export class RadialGradient extends Gradient {
|
|
743
|
+
/**
|
|
744
|
+
* Creates a new radial gradient pattern
|
|
745
|
+
* @param cx0 X coordinate of the start circle
|
|
746
|
+
* @param cy0 Y coordinate of the start circle
|
|
747
|
+
* @param radius0 Radius of the start circle
|
|
748
|
+
* @param cx1 X coordinate of the end circle
|
|
749
|
+
* @param cy1 Y coordinate of the end circle
|
|
750
|
+
* @param radius1 Radius of the end circle
|
|
751
|
+
*/
|
|
752
|
+
constructor(cx0: number, cy0: number, radius0: number, cx1: number, cy1: number, radius1: number);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* A pattern that uses a surface as its source
|
|
757
|
+
*/
|
|
758
|
+
export class SurfacePattern extends Pattern {
|
|
759
|
+
/**
|
|
760
|
+
* Creates a new pattern for the given surface
|
|
761
|
+
* @param surface The surface to use
|
|
762
|
+
*/
|
|
763
|
+
constructor(surface: Surface);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* A pattern for solid colors
|
|
768
|
+
*/
|
|
769
|
+
export class SolidPattern extends Pattern {
|
|
770
|
+
/**
|
|
771
|
+
* Creates a new solid pattern with an opaque color
|
|
772
|
+
* @param red Red component, between 0 and 1
|
|
773
|
+
* @param green Green component, between 0 and 1
|
|
774
|
+
* @param blue Blue component, between 0 and 1
|
|
775
|
+
* @returns A new solid pattern
|
|
776
|
+
*/
|
|
777
|
+
static createRGB(red: number, green: number, blue: number): SolidPattern;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Creates a new solid pattern with a transparent color
|
|
781
|
+
* @param red Red component, between 0 and 1
|
|
782
|
+
* @param green Green component, between 0 and 1
|
|
783
|
+
* @param blue Blue component, between 0 and 1
|
|
784
|
+
* @param alpha Alpha component, between 0 and 1
|
|
785
|
+
* @returns A new solid pattern
|
|
786
|
+
*/
|
|
787
|
+
static createRGBA(red: number, green: number, blue: number, alpha: number): SolidPattern;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
export class Path extends Cairo.Path {}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* A rectangle
|
|
794
|
+
*/
|
|
795
|
+
export class Rectangle extends Cairo.Rectangle {}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* A rectangle integer
|
|
799
|
+
*/
|
|
800
|
+
export class RectangleInt extends Cairo.RectangleInt {}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* A region object used for representing a set of pixels
|
|
804
|
+
*/
|
|
805
|
+
export class Region extends Cairo.Region {}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* A matrix object used for transforming coordinates
|
|
809
|
+
*/
|
|
810
|
+
export class Matrix extends Cairo.Matrix {}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* A font face object used for storing and manipulating font faces
|
|
814
|
+
*/
|
|
815
|
+
export class FontFace extends Cairo.FontFace {}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* A scaled font object used for storing and manipulating scaled fonts
|
|
819
|
+
*/
|
|
820
|
+
export class ScaledFont extends Cairo.ScaledFont {}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* A glyph object used for storing and manipulating glyphs
|
|
824
|
+
*/
|
|
825
|
+
export class Glyph extends Cairo.Glyph {}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* A text cluster object used for storing and manipulating text clusters
|
|
829
|
+
*/
|
|
830
|
+
export class TextCluster extends Cairo.TextCluster {}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* A font options object used for storing and manipulating font options
|
|
834
|
+
*/
|
|
835
|
+
export class FontOptions extends Cairo.FontOptions {}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* A device object used for storing and manipulating devices
|
|
839
|
+
*/
|
|
840
|
+
export class Device extends Cairo.Device {}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
export default giCairo;
|