@girs/gjs 4.0.0-beta.9 → 4.0.0-rc.2

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