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

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