@girs/gjs 4.0.0-beta.21 → 4.0.0-beta.23

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.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/cairo.d.ts +732 -377
  3. package/gjs.d.ts +150 -35
  4. package/package.json +5 -5
package/cairo.d.ts CHANGED
@@ -1,488 +1,843 @@
1
1
  // Cairo 1.0
2
- import type Cairo from '@girs/cairo-1.0';
2
+ import Cairo from '@girs/cairo-1.0';
3
3
  import type GObject from '@girs/gobject-2.0';
4
4
 
5
5
  declare namespace giCairo {
6
- // Add overrides here
7
- // See
8
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/cairo.md
9
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairoModule.js
10
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairo.js
11
- // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/cairo-context.cpp
12
-
13
- // START Re-exported enums, copied from cairo-1.0.d.ts
14
- export namespace Status {
15
- export const $gtype: GObject.GType<Status>;
16
- }
17
-
18
- enum Status {
19
- SUCCESS,
20
- NO_MEMORY,
21
- INVALID_RESTORE,
22
- INVALID_POP_GROUP,
23
- NO_CURRENT_POINT,
24
- INVALID_MATRIX,
25
- INVALID_STATUS,
26
- NULL_POINTER,
27
- INVALID_STRING,
28
- INVALID_PATH_DATA,
29
- READ_ERROR,
30
- WRITE_ERROR,
31
- SURFACE_FINISHED,
32
- SURFACE_TYPE_MISMATCH,
33
- PATTERN_TYPE_MISMATCH,
34
- INVALID_CONTENT,
35
- INVALID_FORMAT,
36
- INVALID_VISUAL,
37
- FILE_NOT_FOUND,
38
- INVALID_DASH,
39
- INVALID_DSC_COMMENT,
40
- INVALID_INDEX,
41
- CLIP_NOT_REPRESENTABLE,
42
- TEMP_FILE_ERROR,
43
- INVALID_STRIDE,
44
- FONT_TYPE_MISMATCH,
45
- USER_FONT_IMMUTABLE,
46
- USER_FONT_ERROR,
47
- NEGATIVE_COUNT,
48
- INVALID_CLUSTERS,
49
- INVALID_SLANT,
50
- INVALID_WEIGHT,
51
- INVALID_SIZE,
52
- USER_FONT_NOT_IMPLEMENTED,
53
- DEVICE_TYPE_MISMATCH,
54
- DEVICE_ERROR,
55
- INVALID_MESH_CONSTRUCTION,
56
- DEVICE_FINISHED,
57
- JBIG2_GLOBAL_MISSING,
58
- }
59
-
60
- export namespace Content {
61
- export const $gtype: GObject.GType<Content>;
62
- }
63
-
64
- enum Content {
65
- COLOR,
66
- ALPHA,
67
- COLOR_ALPHA,
68
- }
69
-
70
- export namespace Operator {
71
- export const $gtype: GObject.GType<Operator>;
72
- }
73
-
74
- enum Operator {
75
- CLEAR,
76
- SOURCE,
77
- OVER,
78
- IN,
79
- OUT,
80
- ATOP,
81
- DEST,
82
- DEST_OVER,
83
- DEST_IN,
84
- DEST_OUT,
85
- DEST_ATOP,
86
- XOR,
87
- ADD,
88
- SATURATE,
89
- MULTIPLY,
90
- SCREEN,
91
- OVERLAY,
92
- DARKEN,
93
- LIGHTEN,
94
- COLOR_DODGE,
95
- COLOR_BURN,
96
- HARD_LIGHT,
97
- SOFT_LIGHT,
98
- DIFFERENCE,
99
- EXCLUSION,
100
- HSL_HUE,
101
- HSL_SATURATION,
102
- HSL_COLOR,
103
- HSL_LUMINOSITY,
104
- }
105
-
106
- export namespace Antialias {
107
- export const $gtype: GObject.GType<Antialias>;
108
- }
109
-
110
- enum Antialias {
111
- DEFAULT,
112
- NONE,
113
- GRAY,
114
- SUBPIXEL,
115
- FAST,
116
- GOOD,
117
- BEST,
118
- }
119
-
120
- export namespace FillRule {
121
- export const $gtype: GObject.GType<FillRule>;
122
- }
123
-
124
- enum FillRule {
125
- WINDING,
126
- EVEN_ODD,
127
- }
128
-
129
- export namespace LineCap {
130
- export const $gtype: GObject.GType<LineCap>;
131
- }
132
-
133
- enum LineCap {
134
- BUTT,
135
- ROUND,
136
- SQUARE,
137
- }
138
-
139
- export namespace LineJoin {
140
- export const $gtype: GObject.GType<LineJoin>;
141
- }
142
-
143
- enum LineJoin {
144
- MITER,
145
- ROUND,
146
- BEVEL,
147
- }
148
-
149
- export namespace TextClusterFlags {
150
- export const $gtype: GObject.GType<TextClusterFlags>;
151
- }
152
-
153
- enum TextClusterFlags {
154
- BACKWARD,
155
- }
156
-
157
- export namespace FontSlant {
158
- export const $gtype: GObject.GType<FontSlant>;
159
- }
160
-
161
- enum FontSlant {
162
- NORMAL,
163
- ITALIC,
164
- OBLIQUE,
165
- }
166
-
167
- export namespace FontWeight {
168
- export const $gtype: GObject.GType<FontWeight>;
169
- }
170
-
171
- enum FontWeight {
172
- NORMAL,
173
- BOLD,
174
- }
175
-
176
- export namespace SubpixelOrder {
177
- export const $gtype: GObject.GType<SubpixelOrder>;
178
- }
179
-
180
- enum SubpixelOrder {
181
- DEFAULT,
182
- RGB,
183
- BGR,
184
- VRGB,
185
- VBGR,
186
- }
187
-
188
- export namespace HintStyle {
189
- export const $gtype: GObject.GType<HintStyle>;
190
- }
191
-
192
- enum HintStyle {
193
- DEFAULT,
194
- NONE,
195
- SLIGHT,
196
- MEDIUM,
197
- FULL,
198
- }
199
-
200
- export namespace HintMetrics {
201
- export const $gtype: GObject.GType<HintMetrics>;
202
- }
203
-
204
- enum HintMetrics {
205
- DEFAULT,
206
- OFF,
207
- ON,
208
- }
209
-
210
- export namespace FontType {
211
- export const $gtype: GObject.GType<FontType>;
212
- }
213
-
214
- enum FontType {
215
- TOY,
216
- FT,
217
- WIN32,
218
- QUARTZ,
219
- USER,
220
- }
221
-
222
- export namespace PathDataType {
223
- export const $gtype: GObject.GType<PathDataType>;
224
- }
225
-
226
- enum PathDataType {
227
- MOVE_TO,
228
- LINE_TO,
229
- CURVE_TO,
230
- CLOSE_PATH,
231
- }
232
-
233
- export namespace DeviceType {
234
- export const $gtype: GObject.GType<DeviceType>;
235
- }
236
-
237
- enum DeviceType {
238
- DRM,
239
- GL,
240
- SCRIPT,
241
- XCB,
242
- XLIB,
243
- XML,
244
- COGL,
245
- WIN32,
246
- INVALID,
247
- }
248
-
249
- export namespace SurfaceType {
250
- export const $gtype: GObject.GType<SurfaceType>;
251
- }
252
-
253
- enum SurfaceType {
254
- IMAGE,
255
- PDF,
256
- PS,
257
- XLIB,
258
- XCB,
259
- GLITZ,
260
- QUARTZ,
261
- WIN32,
262
- BEOS,
263
- DIRECTFB,
264
- SVG,
265
- OS2,
266
- WIN32_PRINTING,
267
- QUARTZ_IMAGE,
268
- SCRIPT,
269
- QT,
270
- RECORDING,
271
- VG,
272
- GL,
273
- DRM,
274
- TEE,
275
- XML,
276
- SKIA,
277
- SUBSURFACE,
278
- COGL,
279
- }
280
-
281
- export namespace Format {
282
- export const $gtype: GObject.GType<Format>;
283
- }
284
-
285
- enum Format {
286
- INVALID,
287
- ARGB32,
288
- RGB24,
289
- A8,
290
- A1,
291
- RGB16_565,
292
- RGB30,
293
- }
294
-
295
- export namespace PatternType {
296
- export const $gtype: GObject.GType<PatternType>;
297
- }
298
-
299
- enum PatternType {
300
- SOLID,
301
- SURFACE,
302
- LINEAR,
303
- RADIAL,
304
- MESH,
305
- RASTER_SOURCE,
306
- }
307
-
308
- export namespace Extend {
309
- export const $gtype: GObject.GType<Extend>;
310
- }
311
-
312
- enum Extend {
313
- NONE,
314
- REPEAT,
315
- REFLECT,
316
- PAD,
317
- }
318
-
319
- export namespace Filter {
320
- export const $gtype: GObject.GType<Filter>;
321
- }
322
-
323
- enum Filter {
324
- FAST,
325
- GOOD,
326
- BEST,
327
- NEAREST,
328
- BILINEAR,
329
- GAUSSIAN,
330
- }
331
-
332
- export namespace RegionOverlap {
333
- export const $gtype: GObject.GType<RegionOverlap>;
334
- }
335
-
336
- enum RegionOverlap {
337
- IN,
338
- OUT,
339
- PART,
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;
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;
340
46
  }
341
47
 
342
- // END Re-exported enums, copied from cairo-1.0.d.ts
343
-
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
+ */
344
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
+ */
345
59
  constructor(surface: Surface);
346
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
+ */
347
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
+ */
348
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
+ */
349
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
+ */
350
105
  clip(): void;
106
+
107
+ /**
108
+ * Like clip() but preserves the current path
109
+ */
351
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
+ */
352
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
+ */
353
121
  closePath(): void;
122
+
123
+ /**
124
+ * Emits the current page, but doesn't clear it
125
+ */
354
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
+ */
355
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
+ */
356
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
+ */
357
147
  fill(): void;
148
+
149
+ /**
150
+ * Fills the current path using the current fill rule, but doesn't clear the path
151
+ */
358
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
+ */
359
158
  fillExtents(): [number, number, number, number];
159
+
160
+ /**
161
+ * Gets the current antialiasing mode
162
+ * @returns The current antialiasing mode
163
+ */
360
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
+ */
361
170
  getCurrentPoint(): [number, number];
171
+
172
+ /**
173
+ * Gets the current dash count
174
+ * @returns The number of elements in the current dash pattern
175
+ */
362
176
  getDashCount(): number;
177
+
178
+ /**
179
+ * Gets the current fill rule
180
+ * @returns The current fill rule
181
+ */
363
182
  getFillRule(): FillRule;
183
+
184
+ /**
185
+ * Gets the current line cap style
186
+ * @returns The current line cap style
187
+ */
364
188
  getLineCap(): LineCap;
189
+
190
+ /**
191
+ * Gets the current line join style
192
+ * @returns The current line join style
193
+ */
365
194
  getLineJoin(): LineJoin;
195
+
196
+ /**
197
+ * Gets the current line width
198
+ * @returns The current line width
199
+ */
366
200
  getLineWidth(): number;
201
+
202
+ /**
203
+ * Gets the current miter limit
204
+ * @returns The current miter limit
205
+ */
367
206
  getMiterLimit(): number;
207
+
208
+ /**
209
+ * Gets the current compositing operator
210
+ * @returns The current compositing operator
211
+ */
368
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
+ */
369
230
  getTolerance(): number;
231
+
232
+ /**
233
+ * Checks if there is a current point defined
234
+ * @returns True if there is a current point
235
+ */
370
236
  hasCurrentPoint(): boolean;
237
+
238
+ /**
239
+ * Resets the current transformation matrix to the identity matrix
240
+ */
371
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
+ */
372
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
+ */
373
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
+ */
374
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
+ */
375
286
  moveTo(x: number, y: number): void;
287
+
288
+ /**
289
+ * Clears the current path and begins a new path
290
+ */
376
291
  newPath(): void;
292
+
293
+ /**
294
+ * Begins a new subpath without changing the current point
295
+ */
377
296
  newSubPath(): void;
297
+
298
+ /**
299
+ * Paints the current source everywhere within the current clip region
300
+ */
378
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
+ */
379
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
+ */
380
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
+ */
381
321
  popGroup(): Pattern;
322
+
323
+ /**
324
+ * Terminates the current pattern group and makes it the current source pattern
325
+ */
382
326
  popGroupToSource(): void;
327
+
328
+ /**
329
+ * Temporarily redirects drawing to an intermediate surface
330
+ */
383
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
+ */
384
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
+ */
385
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
+ */
386
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
+ */
387
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
+ */
388
371
  relMoveTo(dx: number, dy: number): void;
372
+
373
+ /**
374
+ * Resets the current clip region to its original, unrestricted state
375
+ */
389
376
  resetClip(): void;
377
+
378
+ /**
379
+ * Restores the context state from the stack
380
+ */
390
381
  restore(): void;
382
+
383
+ /**
384
+ * Rotates the current transformation matrix
385
+ * @param angle Angle of rotation in radians
386
+ */
391
387
  rotate(angle: number): void;
388
+
389
+ /**
390
+ * Saves the current context state to the stack
391
+ */
392
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
+ */
393
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
+ */
394
407
  selectFontFace(family: string, slant: number, weight: number): void;
408
+
409
+ /**
410
+ * Sets the antialiasing mode
411
+ * @param antialias The new antialiasing mode
412
+ */
395
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
+ */
396
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
+ */
397
426
  setFontSize(size: number): void;
427
+
428
+ /**
429
+ * Sets the current fill rule
430
+ * @param fillRule The new fill rule
431
+ */
398
432
  setFillRule(fillRule: FillRule): void;
433
+
434
+ /**
435
+ * Sets the current line cap style
436
+ * @param lineCap The new line cap style
437
+ */
399
438
  setLineCap(lineCap: LineCap): void;
439
+
440
+ /**
441
+ * Sets the current line join style
442
+ * @param lineJoin The new line join style
443
+ */
400
444
  setLineJoin(lineJoin: LineJoin): void;
445
+
446
+ /**
447
+ * Sets the current line width
448
+ * @param width The new line width
449
+ */
401
450
  setLineWidth(width: number): void;
451
+
452
+ /**
453
+ * Sets the current miter limit
454
+ * @param limit The new miter limit
455
+ */
402
456
  setMiterLimit(limit: number): void;
457
+
458
+ /**
459
+ * Sets the current compositing operator
460
+ * @param op The new compositing operator
461
+ */
403
462
  setOperator(op: Operator): void;
463
+
464
+ /**
465
+ * Sets the current source pattern
466
+ * @param pattern The new source pattern
467
+ */
404
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
+ */
405
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
+ */
406
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
+ */
407
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
+ */
408
499
  setTolerance(tolerance: number): void;
500
+
501
+ /**
502
+ * Emits the current page and clears it
503
+ */
409
504
  showPage(): void;
505
+
506
+ /**
507
+ * Draws text at the current position
508
+ * @param utf8 A string of text encoded in UTF-8
509
+ */
410
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
+ */
411
516
  stroke(): void;
517
+
518
+ /**
519
+ * Like stroke() but preserves the current path
520
+ */
412
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
+ */
413
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
+ */
414
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
+ */
415
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
+ */
416
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
+ */
417
557
  userToDeviceDistance(x: number, y: number): [number, number];
418
- }
419
558
 
420
- export abstract class Surface extends Cairo.Surface {
421
- // TODO
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;
422
570
  }
423
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
+ */
424
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
+ */
425
623
  constructor(format: Format, width: number, height: number);
426
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
+ */
427
630
  static createFromPNG(filename: string): ImageSurface;
428
631
 
429
- // TODO
430
- }
431
-
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
+ */
432
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
+ */
433
667
  constructor(filename: string, width: number, height: number);
434
-
435
- // TODO
436
668
  }
437
669
 
670
+ /**
671
+ * A surface that produces output in the PostScript format
672
+ */
438
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
+ */
439
680
  constructor(filename: string, width: number, height: number);
440
-
441
- // TODO
442
681
  }
443
682
 
683
+ /**
684
+ * A surface that produces output in the SVG format
685
+ */
444
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
+ */
445
693
  constructor(filename: string, width: number, height: number);
446
-
447
- // TODO
448
694
  }
449
695
 
450
- export class Pattern extends Cairo.Pattern {
451
- // TODO
452
- }
696
+ /**
697
+ * Base class for all Cairo patterns
698
+ */
699
+ export class Pattern extends Cairo.Pattern {}
453
700
 
701
+ /**
702
+ * Base class for all gradient patterns
703
+ */
454
704
  export class Gradient extends Pattern {
455
- // TODO
456
- }
457
-
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
+ */
458
728
  export class LinearGradient extends Gradient {
459
- // TODO
460
- }
461
-
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
+ */
462
742
  export class RadialGradient extends Gradient {
463
- // TODO
464
- }
465
-
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
+ */
466
758
  export class SurfacePattern extends Pattern {
467
- // TODO
759
+ /**
760
+ * Creates a new pattern for the given surface
761
+ * @param surface The surface to use
762
+ */
763
+ constructor(surface: Surface);
468
764
  }
469
765
 
766
+ /**
767
+ * A pattern for solid colors
768
+ */
470
769
  export class SolidPattern extends Pattern {
471
- // TODO
472
- }
473
-
474
- export class Path extends Cairo.Path {
475
- // TODO
476
- }
477
-
478
- export interface TextExtents {
479
- xBearing: number;
480
- yBearing: number;
481
- width: number;
482
- height: number;
483
- xAdvance: number;
484
- yAdvance: number;
485
- }
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 {}
486
841
  }
487
842
 
488
843
  export default giCairo;