@girs/gly-2 2.0.0-4.0.0-beta.37

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/gly-2.d.ts ADDED
@@ -0,0 +1,1205 @@
1
+ /**
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ *
7
+ * The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
8
+ */
9
+
10
+ import '@girs/gjs';
11
+
12
+ // Module dependencies
13
+ import type Gio from '@girs/gio-2.0';
14
+ import type GObject from '@girs/gobject-2.0';
15
+ import type GLib from '@girs/glib-2.0';
16
+ import type GModule from '@girs/gmodule-2.0';
17
+
18
+ export namespace Gly {
19
+ /**
20
+ * Gly-2
21
+ */
22
+
23
+ /**
24
+ * Errors that can appear while loading images.
25
+ */
26
+ class LoaderError extends GLib.Error {
27
+ static $gtype: GObject.GType<LoaderError>;
28
+
29
+ // Static fields
30
+
31
+ /**
32
+ * Generic type for all other errors.
33
+ */
34
+ static FAILED: number;
35
+ /**
36
+ * Unknown image format.
37
+ */
38
+ static UNKNOWN_IMAGE_FORMAT: number;
39
+
40
+ // Constructors
41
+
42
+ constructor(options: { message: string; code: number });
43
+ _init(...args: any[]): void;
44
+
45
+ // Static methods
46
+
47
+ /**
48
+ * Error quark for [error`GlyLoaderError]`
49
+ */
50
+ static quark(): GLib.Quark;
51
+ }
52
+
53
+ /**
54
+ * Memory format
55
+ */
56
+
57
+ /**
58
+ * Memory format
59
+ */
60
+ export namespace MemoryFormat {
61
+ export const $gtype: GObject.GType<MemoryFormat>;
62
+ }
63
+
64
+ enum MemoryFormat {
65
+ /**
66
+ * 8-bit RGRA premultiplied
67
+ */
68
+ B8G8R8A8_PREMULTIPLIED,
69
+ /**
70
+ * 8-bit ARGB premultiplied
71
+ */
72
+ A8R8G8B8_PREMULTIPLIED,
73
+ /**
74
+ * 8-bit RGBA premultiplied
75
+ */
76
+ R8G8B8A8_PREMULTIPLIED,
77
+ /**
78
+ * 8-bit RGBA
79
+ */
80
+ B8G8R8A8,
81
+ /**
82
+ * 8-bit AGBR
83
+ */
84
+ A8R8G8B8,
85
+ /**
86
+ * 8-bit RGBA
87
+ */
88
+ R8G8B8A8,
89
+ /**
90
+ * 8-bit ABGR
91
+ */
92
+ A8B8G8R8,
93
+ /**
94
+ * 8-bit RGB
95
+ */
96
+ R8G8B8,
97
+ /**
98
+ * 8-bit BGR
99
+ */
100
+ B8G8R8,
101
+ /**
102
+ * 16-bit RGB
103
+ */
104
+ R16G16B16,
105
+ /**
106
+ * 16-bit RGBA premultiplied
107
+ */
108
+ R16G16B16A16_PREMULTIPLIED,
109
+ /**
110
+ * 16-bit RGBA
111
+ */
112
+ R16G16B16A16,
113
+ /**
114
+ * 16-bit float RGB
115
+ */
116
+ R16G16B16_FLOAT,
117
+ /**
118
+ * 16-bit float RGBA
119
+ */
120
+ R16G16B16A16_FLOAT,
121
+ /**
122
+ * 32-bit float RGB
123
+ */
124
+ R32G32B32_FLOAT,
125
+ /**
126
+ * 32-bit float RGBA premultiplied
127
+ */
128
+ R32G32B32A32_FLOAT_PREMULTIPLIED,
129
+ /**
130
+ * 16-bit float RGBA
131
+ */
132
+ R32G32B32A32_FLOAT,
133
+ /**
134
+ * 8-bit gray with alpha premultiplied
135
+ */
136
+ G8A8_PREMULTIPLIED,
137
+ /**
138
+ * 8-bit gray with alpha
139
+ */
140
+ G8A8,
141
+ /**
142
+ * 8-bit gray
143
+ */
144
+ G8,
145
+ /**
146
+ * 16-bit gray with alpha premultiplied
147
+ */
148
+ G16A16_PREMULTIPLIED,
149
+ /**
150
+ * 16-bit gray with alpha
151
+ */
152
+ G16A16,
153
+ /**
154
+ * 16-bit gray
155
+ */
156
+ G16,
157
+ }
158
+ /**
159
+ * Sandbox mechanisms
160
+ *
161
+ * ::: warning
162
+ * Using `GLY_SANDBOX_SELECTOR_NOT_SANDBOXED` will disable an important security layer that sandboxes loaders. It is only intended for testing and development purposes.
163
+ */
164
+
165
+ /**
166
+ * Sandbox mechanisms
167
+ *
168
+ * ::: warning
169
+ * Using `GLY_SANDBOX_SELECTOR_NOT_SANDBOXED` will disable an important security layer that sandboxes loaders. It is only intended for testing and development purposes.
170
+ */
171
+ export namespace SandboxSelector {
172
+ export const $gtype: GObject.GType<SandboxSelector>;
173
+ }
174
+
175
+ enum SandboxSelector {
176
+ /**
177
+ * This mode selects `bwrap` outside of Flatpaks and usually
178
+ * `flatpak-spawn` inside of Flatpaks. The sandbox is disabled
179
+ * automatically inside of Flatpak development environments.
180
+ * Inside of Flatpaks, `flatpak-spawn` is used to create the sandbox. This
181
+ * mechanism starts an installed Flatpak with the same app id. For
182
+ * development, Flatpak are usually not installed and the sandbox can
183
+ * therefore not be used. If the sandbox has been started via
184
+ * `flatpak-builder --run` (i.e. without installed Flatpak) and the app id
185
+ * ends with `Devel`, the sandbox is disabled.
186
+ */
187
+ AUTO,
188
+ /**
189
+ * bwrap
190
+ */
191
+ BWRAP,
192
+ /**
193
+ * flatpak-spawn
194
+ */
195
+ FLATPAK_SPAWN,
196
+ /**
197
+ * Disable sandbox. Unsafe, only use for testing and development.
198
+ */
199
+ NOT_SANDBOXED,
200
+ }
201
+ /**
202
+ * Error quark for [error`GlyLoaderError]`
203
+ * @returns The error domain
204
+ */
205
+ function loader_error_quark(): GLib.Quark;
206
+ /**
207
+ * Whether a memory format has an alpha channel
208
+ * @param memory_format
209
+ * @returns Returns `TRUE` if the memory format has an alpha channel
210
+ */
211
+ function memory_format_has_alpha(memory_format: MemoryFormat | null): boolean;
212
+ /**
213
+ * Whether a memory format has an alpha channel and the color values are
214
+ * premultiplied with the alpha value
215
+ * @param memory_format
216
+ * @returns Returns `TRUE` if color channels are premultiplied
217
+ */
218
+ function memory_format_is_premultiplied(memory_format: MemoryFormat | null): boolean;
219
+ interface LoaderGetMimeTypesDoneFunc {
220
+ (mime_types: string[], data?: any | null): void;
221
+ }
222
+ /**
223
+ * Memory format selection
224
+ */
225
+
226
+ /**
227
+ * Memory format selection
228
+ */
229
+ export namespace MemoryFormatSelection {
230
+ export const $gtype: GObject.GType<MemoryFormatSelection>;
231
+ }
232
+
233
+ enum MemoryFormatSelection {
234
+ /**
235
+ * 8-bit RGRA premultiplied
236
+ */
237
+ B8G8R8A8_PREMULTIPLIED,
238
+ /**
239
+ * 8-bit ARGB premultiplied
240
+ */
241
+ A8R8G8B8_PREMULTIPLIED,
242
+ /**
243
+ * 8-bit RGBA premultiplied
244
+ */
245
+ R8G8B8A8_PREMULTIPLIED,
246
+ /**
247
+ * 8-bit RGBA
248
+ */
249
+ B8G8R8A8,
250
+ /**
251
+ * 8-bit AGBR
252
+ */
253
+ A8R8G8B8,
254
+ /**
255
+ * 8-bit RGBA
256
+ */
257
+ R8G8B8A8,
258
+ /**
259
+ * 8-bit ABGR
260
+ */
261
+ A8B8G8R8,
262
+ /**
263
+ * 8-bit RGB
264
+ */
265
+ R8G8B8,
266
+ /**
267
+ * 8-bit BGR
268
+ */
269
+ B8G8R8,
270
+ /**
271
+ * 16-bit RGB
272
+ */
273
+ R16G16B16,
274
+ /**
275
+ * 16-bit RGBA premultiplied
276
+ */
277
+ R16G16B16A16_PREMULTIPLIED,
278
+ /**
279
+ * 16-bit RGBA
280
+ */
281
+ R16G16B16A16,
282
+ /**
283
+ * 16-bit float RGB
284
+ */
285
+ R16G16B16_FLOAT,
286
+ /**
287
+ * 16-bit float RGBA
288
+ */
289
+ R16G16B16A16_FLOAT,
290
+ /**
291
+ * 32-bit float RGB
292
+ */
293
+ R32G32B32_FLOAT,
294
+ /**
295
+ * 32-bit float RGBA premultiplied
296
+ */
297
+ R32G32B32A32_FLOAT_PREMULTIPLIED,
298
+ /**
299
+ * 16-bit float RGBA
300
+ */
301
+ R32G32B32A32_FLOAT,
302
+ /**
303
+ * 8-bit gray with alpha premultiplied
304
+ */
305
+ G8A8_PREMULTIPLIED,
306
+ /**
307
+ * 8-bit gray with alpha
308
+ */
309
+ G8A8,
310
+ /**
311
+ * 8-bit gray
312
+ */
313
+ G8,
314
+ /**
315
+ * 16-bit gray with alpha premultiplied
316
+ */
317
+ G16A16_PREMULTIPLIED,
318
+ /**
319
+ * 16-bit gray with alpha
320
+ */
321
+ G16A16,
322
+ /**
323
+ * 16-bit gray
324
+ */
325
+ G16,
326
+ }
327
+ namespace Creator {
328
+ // Signal signatures
329
+ interface SignalSignatures extends GObject.Object.SignalSignatures {
330
+ 'notify::mime-type': (pspec: GObject.ParamSpec) => void;
331
+ 'notify::sandbox-selector': (pspec: GObject.ParamSpec) => void;
332
+ }
333
+
334
+ // Constructor properties interface
335
+
336
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
337
+ mime_type: string;
338
+ mimeType: string;
339
+ sandbox_selector: SandboxSelector;
340
+ sandboxSelector: SandboxSelector;
341
+ }
342
+ }
343
+
344
+ /**
345
+ * Image creator
346
+ *
347
+ * ```c
348
+ * #include <glycin.h>
349
+ *
350
+ * GlyCreator *creator = gly_creator_new("image/jpeg", NULL);
351
+ *
352
+ * if (!creator)
353
+ * return;
354
+ *
355
+ * // Create frame with a single red pixel
356
+ * guint8 data[] = {255, 0, 0};
357
+ * gsize length = sizeof(data);
358
+ * GBytes *texture = g_bytes_new(data, length);
359
+ * GlyNewFrame *new_frame = gly_creator_add_frame(creator, 1, 1, GLY_MEMORY_R8G8B8, texture);
360
+ *
361
+ * // Create JPEG
362
+ * GlyEncodedImage *encoded_image = gly_creator_create(creator, NULL);
363
+ *
364
+ * if (encoded_image)
365
+ * {
366
+ * GBytes *binary_data = gly_encoded_image_get_data(encoded_image);
367
+ * if (binary_data)
368
+ * {
369
+ * // Write image to file
370
+ * GFile *file = g_file_new_for_path("test.jpg");
371
+ * g_file_replace_contents(
372
+ * file,
373
+ * g_bytes_get_data(binary_data, NULL),
374
+ * g_bytes_get_size(binary_data),
375
+ * NULL,
376
+ * FALSE,
377
+ * G_FILE_CREATE_NONE,
378
+ * NULL,
379
+ * NULL,
380
+ * NULL);
381
+ * }
382
+ * }
383
+ * ```
384
+ */
385
+ class Creator extends GObject.Object {
386
+ static $gtype: GObject.GType<Creator>;
387
+
388
+ // Properties
389
+
390
+ get mime_type(): string;
391
+ get mimeType(): string;
392
+ get sandbox_selector(): SandboxSelector;
393
+ set sandbox_selector(val: SandboxSelector);
394
+ get sandboxSelector(): SandboxSelector;
395
+ set sandboxSelector(val: SandboxSelector);
396
+
397
+ /**
398
+ * Compile-time signal type information.
399
+ *
400
+ * This instance property is generated only for TypeScript type checking.
401
+ * It is not defined at runtime and should not be accessed in JS code.
402
+ * @internal
403
+ */
404
+ $signals: Creator.SignalSignatures;
405
+
406
+ // Constructors
407
+
408
+ constructor(properties?: Partial<Creator.ConstructorProps>, ...args: any[]);
409
+
410
+ _init(...args: any[]): void;
411
+
412
+ static ['new'](mime_type: string): Creator;
413
+
414
+ // Signals
415
+
416
+ connect<K extends keyof Creator.SignalSignatures>(
417
+ signal: K,
418
+ callback: GObject.SignalCallback<this, Creator.SignalSignatures[K]>,
419
+ ): number;
420
+ connect(signal: string, callback: (...args: any[]) => any): number;
421
+ connect_after<K extends keyof Creator.SignalSignatures>(
422
+ signal: K,
423
+ callback: GObject.SignalCallback<this, Creator.SignalSignatures[K]>,
424
+ ): number;
425
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
426
+ emit<K extends keyof Creator.SignalSignatures>(
427
+ signal: K,
428
+ ...args: GObject.GjsParameters<Creator.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
429
+ ): void;
430
+ emit(signal: string, ...args: any[]): void;
431
+
432
+ // Methods
433
+
434
+ add_frame(
435
+ width: number,
436
+ height: number,
437
+ memory_format: MemoryFormat | null,
438
+ texture: GLib.Bytes | Uint8Array,
439
+ ): NewFrame;
440
+ add_frame_with_stride(
441
+ width: number,
442
+ height: number,
443
+ stride: number,
444
+ memory_format: MemoryFormat | null,
445
+ texture: GLib.Bytes | Uint8Array,
446
+ ): NewFrame;
447
+ /**
448
+ * Add metadata that are stored as key-value pairs.
449
+ * A prominent example are PNG's `tEXt` chunks.
450
+ *
451
+ * If an entry with `key` already exists, it will be replaced.
452
+ * @param key A null-terminated string.
453
+ * @param value A null-terminated string.
454
+ * @returns `TRUE` if format supports key-value storage.
455
+ */
456
+ add_metadata_key_value(key: string, value: string): boolean;
457
+ create(): EncodedImage | null;
458
+ /**
459
+ * Asynchronous version of [method`Creator`.create].
460
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
461
+ */
462
+ create_async(cancellable?: Gio.Cancellable | null): globalThis.Promise<EncodedImage>;
463
+ /**
464
+ * Asynchronous version of [method`Creator`.create].
465
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
466
+ * @param callback A callback to call when the operation is complete
467
+ */
468
+ create_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
469
+ /**
470
+ * Asynchronous version of [method`Creator`.create].
471
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
472
+ * @param callback A callback to call when the operation is complete
473
+ */
474
+ create_async(
475
+ cancellable?: Gio.Cancellable | null,
476
+ callback?: Gio.AsyncReadyCallback<this> | null,
477
+ ): globalThis.Promise<EncodedImage> | void;
478
+ /**
479
+ * Finishes the [method`Creator`.create_async] call.
480
+ * @param result A `GAsyncResult`
481
+ * @returns Encoded image.
482
+ */
483
+ create_finish(result: Gio.AsyncResult): EncodedImage;
484
+ set_encoding_compression(compression: number): boolean;
485
+ set_encoding_quality(quality: number): boolean;
486
+ /**
487
+ * Selects which sandbox mechanism should be used. The default without calling this function is [enum`SandboxSelector]``.AUTO`.
488
+ * @param sandbox_selector Method by which the sandbox mechanism is selected
489
+ */
490
+ set_sandbox_selector(sandbox_selector: SandboxSelector | null): boolean;
491
+ }
492
+
493
+ namespace EncodedImage {
494
+ // Signal signatures
495
+ interface SignalSignatures extends GObject.Object.SignalSignatures {
496
+ 'notify::data': (pspec: GObject.ParamSpec) => void;
497
+ }
498
+
499
+ // Constructor properties interface
500
+
501
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
502
+ data: GLib.Bytes;
503
+ }
504
+ }
505
+
506
+ /**
507
+ * Encoded image
508
+ */
509
+ class EncodedImage extends GObject.Object {
510
+ static $gtype: GObject.GType<EncodedImage>;
511
+
512
+ // Properties
513
+
514
+ get data(): GLib.Bytes;
515
+
516
+ /**
517
+ * Compile-time signal type information.
518
+ *
519
+ * This instance property is generated only for TypeScript type checking.
520
+ * It is not defined at runtime and should not be accessed in JS code.
521
+ * @internal
522
+ */
523
+ $signals: EncodedImage.SignalSignatures;
524
+
525
+ // Constructors
526
+
527
+ constructor(properties?: Partial<EncodedImage.ConstructorProps>, ...args: any[]);
528
+
529
+ _init(...args: any[]): void;
530
+
531
+ // Signals
532
+
533
+ connect<K extends keyof EncodedImage.SignalSignatures>(
534
+ signal: K,
535
+ callback: GObject.SignalCallback<this, EncodedImage.SignalSignatures[K]>,
536
+ ): number;
537
+ connect(signal: string, callback: (...args: any[]) => any): number;
538
+ connect_after<K extends keyof EncodedImage.SignalSignatures>(
539
+ signal: K,
540
+ callback: GObject.SignalCallback<this, EncodedImage.SignalSignatures[K]>,
541
+ ): number;
542
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
543
+ emit<K extends keyof EncodedImage.SignalSignatures>(
544
+ signal: K,
545
+ ...args: GObject.GjsParameters<EncodedImage.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
546
+ ): void;
547
+ emit(signal: string, ...args: any[]): void;
548
+
549
+ // Methods
550
+
551
+ get_data(): GLib.Bytes;
552
+ // Conflicted with GObject.Object.get_data
553
+ get_data(...args: never[]): any;
554
+ }
555
+
556
+ namespace Frame {
557
+ // Signal signatures
558
+ interface SignalSignatures extends GObject.Object.SignalSignatures {}
559
+
560
+ // Constructor properties interface
561
+
562
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
563
+ }
564
+
565
+ /**
566
+ * A frame of an image often being the complete image.
567
+ */
568
+ class Frame extends GObject.Object {
569
+ static $gtype: GObject.GType<Frame>;
570
+
571
+ /**
572
+ * Compile-time signal type information.
573
+ *
574
+ * This instance property is generated only for TypeScript type checking.
575
+ * It is not defined at runtime and should not be accessed in JS code.
576
+ * @internal
577
+ */
578
+ $signals: Frame.SignalSignatures;
579
+
580
+ // Constructors
581
+
582
+ constructor(properties?: Partial<Frame.ConstructorProps>, ...args: any[]);
583
+
584
+ _init(...args: any[]): void;
585
+
586
+ // Signals
587
+
588
+ connect<K extends keyof Frame.SignalSignatures>(
589
+ signal: K,
590
+ callback: GObject.SignalCallback<this, Frame.SignalSignatures[K]>,
591
+ ): number;
592
+ connect(signal: string, callback: (...args: any[]) => any): number;
593
+ connect_after<K extends keyof Frame.SignalSignatures>(
594
+ signal: K,
595
+ callback: GObject.SignalCallback<this, Frame.SignalSignatures[K]>,
596
+ ): number;
597
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
598
+ emit<K extends keyof Frame.SignalSignatures>(
599
+ signal: K,
600
+ ...args: GObject.GjsParameters<Frame.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
601
+ ): void;
602
+ emit(signal: string, ...args: any[]): void;
603
+
604
+ // Methods
605
+
606
+ /**
607
+ * Image data arranged according to [method`Frame`.get_memory_format]
608
+ * @returns Image data
609
+ */
610
+ get_buf_bytes(): GLib.Bytes;
611
+ /**
612
+ * Returns the CICP (coding-independent code point) for the frames texture.
613
+ * This value is `NULL` if no CICP is used.
614
+ * @returns CICP
615
+ */
616
+ get_color_cicp(): Cicp | null;
617
+ /**
618
+ * Duration to show frame for animations.
619
+ *
620
+ * If the value is zero, the image is not animated.
621
+ * @returns Duration in microseconds.
622
+ */
623
+ get_delay(): number;
624
+ /**
625
+ * Height for image data in pixels
626
+ * @returns Height in pixels
627
+ */
628
+ get_height(): number;
629
+ /**
630
+ * Format of the image data in [method`Gly`.Frame.get_buf_bytes]
631
+ * @returns Format of image data
632
+ */
633
+ get_memory_format(): MemoryFormat;
634
+ /**
635
+ * Width of a row for image data in bytes
636
+ * @returns Row stride in bytes
637
+ */
638
+ get_stride(): number;
639
+ /**
640
+ * Width for image data in pixels
641
+ * @returns Width in pixels
642
+ */
643
+ get_width(): number;
644
+ }
645
+
646
+ namespace FrameRequest {
647
+ // Signal signatures
648
+ interface SignalSignatures extends GObject.Object.SignalSignatures {
649
+ 'notify::scale-height': (pspec: GObject.ParamSpec) => void;
650
+ 'notify::scale-width': (pspec: GObject.ParamSpec) => void;
651
+ }
652
+
653
+ // Constructor properties interface
654
+
655
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
656
+ scale_height: number;
657
+ scaleHeight: number;
658
+ scale_width: number;
659
+ scaleWidth: number;
660
+ }
661
+ }
662
+
663
+ /**
664
+ * Defines which parts of an image to load.
665
+ *
666
+ * ::: warning
667
+ * Loaders can and frequently will ignore instructions set in
668
+ * `GlyFrameRequest`. The reason is that for most loaders
669
+ * many instructions don't have a meaningful interpretation.
670
+ */
671
+ class FrameRequest extends GObject.Object {
672
+ static $gtype: GObject.GType<FrameRequest>;
673
+
674
+ // Properties
675
+
676
+ get scale_height(): number;
677
+ get scaleHeight(): number;
678
+ get scale_width(): number;
679
+ get scaleWidth(): number;
680
+
681
+ /**
682
+ * Compile-time signal type information.
683
+ *
684
+ * This instance property is generated only for TypeScript type checking.
685
+ * It is not defined at runtime and should not be accessed in JS code.
686
+ * @internal
687
+ */
688
+ $signals: FrameRequest.SignalSignatures;
689
+
690
+ // Constructors
691
+
692
+ constructor(properties?: Partial<FrameRequest.ConstructorProps>, ...args: any[]);
693
+
694
+ _init(...args: any[]): void;
695
+
696
+ static ['new'](): FrameRequest;
697
+
698
+ // Signals
699
+
700
+ connect<K extends keyof FrameRequest.SignalSignatures>(
701
+ signal: K,
702
+ callback: GObject.SignalCallback<this, FrameRequest.SignalSignatures[K]>,
703
+ ): number;
704
+ connect(signal: string, callback: (...args: any[]) => any): number;
705
+ connect_after<K extends keyof FrameRequest.SignalSignatures>(
706
+ signal: K,
707
+ callback: GObject.SignalCallback<this, FrameRequest.SignalSignatures[K]>,
708
+ ): number;
709
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
710
+ emit<K extends keyof FrameRequest.SignalSignatures>(
711
+ signal: K,
712
+ ...args: GObject.GjsParameters<FrameRequest.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
713
+ ): void;
714
+ emit(signal: string, ...args: any[]): void;
715
+
716
+ // Methods
717
+
718
+ /**
719
+ * Set maximum dimensions for the frame. The texture will be scaled
720
+ * to be within the maximum dimensions while keeping its aspect ratio.
721
+ * This option is especially useful to SVGs which will be rendered at
722
+ * the respective size.
723
+ *
724
+ * ::: warning
725
+ * Most loaders will ignore this option. Currently, only the SVG
726
+ * loader is known to obay it.
727
+ * @param width Maximum width
728
+ * @param height Maximum height
729
+ */
730
+ set_scale(width: number, height: number): void;
731
+ }
732
+
733
+ namespace Image {
734
+ // Signal signatures
735
+ interface SignalSignatures extends GObject.Object.SignalSignatures {}
736
+
737
+ // Constructor properties interface
738
+
739
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
740
+ }
741
+
742
+ /**
743
+ * Image handle containing metadata and allowing frame requests.
744
+ */
745
+ class Image extends GObject.Object {
746
+ static $gtype: GObject.GType<Image>;
747
+
748
+ /**
749
+ * Compile-time signal type information.
750
+ *
751
+ * This instance property is generated only for TypeScript type checking.
752
+ * It is not defined at runtime and should not be accessed in JS code.
753
+ * @internal
754
+ */
755
+ $signals: Image.SignalSignatures;
756
+
757
+ // Constructors
758
+
759
+ constructor(properties?: Partial<Image.ConstructorProps>, ...args: any[]);
760
+
761
+ _init(...args: any[]): void;
762
+
763
+ // Signals
764
+
765
+ connect<K extends keyof Image.SignalSignatures>(
766
+ signal: K,
767
+ callback: GObject.SignalCallback<this, Image.SignalSignatures[K]>,
768
+ ): number;
769
+ connect(signal: string, callback: (...args: any[]) => any): number;
770
+ connect_after<K extends keyof Image.SignalSignatures>(
771
+ signal: K,
772
+ callback: GObject.SignalCallback<this, Image.SignalSignatures[K]>,
773
+ ): number;
774
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
775
+ emit<K extends keyof Image.SignalSignatures>(
776
+ signal: K,
777
+ ...args: GObject.GjsParameters<Image.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
778
+ ): void;
779
+ emit(signal: string, ...args: any[]): void;
780
+
781
+ // Methods
782
+
783
+ /**
784
+ * See [method`Image`.get_width]
785
+ * @returns height
786
+ */
787
+ get_height(): number;
788
+ /**
789
+ * Get metadata that are stored as key-value pairs.
790
+ * A prominent example are PNG's `tEXt` and `zTXt` chunks.
791
+ *
792
+ * ::: note
793
+ * In contrast to gdk-pixbuf's *option* feature, the
794
+ * keys do not carry prefixes like `tEXt::` or `zTXt::`.
795
+ * @param key A null-terminated string.
796
+ * @returns The UTF-8 encoded value associated with `key`.
797
+ */
798
+ get_metadata_key_value(key: string): string | null;
799
+ /**
800
+ * Get the list of available keys for [method`Image`.get_metadata_key_value].
801
+ * @returns List of existing keys.
802
+ */
803
+ get_metadata_keys(): string[];
804
+ /**
805
+ * Returns detected MIME type of the file
806
+ * @returns MIME type
807
+ */
808
+ get_mime_type(): string;
809
+ get_specific_frame(frame_request: FrameRequest): Frame;
810
+ /**
811
+ * Asynchronous version of [method`Image`.get_specific_frame].
812
+ * @param frame_request
813
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
814
+ */
815
+ get_specific_frame_async(
816
+ frame_request: FrameRequest,
817
+ cancellable?: Gio.Cancellable | null,
818
+ ): globalThis.Promise<Frame>;
819
+ /**
820
+ * Asynchronous version of [method`Image`.get_specific_frame].
821
+ * @param frame_request
822
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
823
+ * @param callback A callback to call when the operation is complete
824
+ */
825
+ get_specific_frame_async(
826
+ frame_request: FrameRequest,
827
+ cancellable: Gio.Cancellable | null,
828
+ callback: Gio.AsyncReadyCallback<this> | null,
829
+ ): void;
830
+ /**
831
+ * Asynchronous version of [method`Image`.get_specific_frame].
832
+ * @param frame_request
833
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
834
+ * @param callback A callback to call when the operation is complete
835
+ */
836
+ get_specific_frame_async(
837
+ frame_request: FrameRequest,
838
+ cancellable?: Gio.Cancellable | null,
839
+ callback?: Gio.AsyncReadyCallback<this> | null,
840
+ ): globalThis.Promise<Frame> | void;
841
+ /**
842
+ * Finishes the [method`Image`.get_specific_frame_async] call.
843
+ * @param result a `GAsyncResult`
844
+ * @returns Loaded frame.
845
+ */
846
+ get_specific_frame_finish(result: Gio.AsyncResult): Frame;
847
+ /**
848
+ * Get the image orientation
849
+ *
850
+ * The image orientation is given in Exif format. The function is
851
+ * guaranteed to only return values from 1 to 8.
852
+ *
853
+ * If [method`Loader`.set_apply_transformations] is set to `FALSE`,
854
+ * the orientation has to be corrected manually to dispaly the image
855
+ * correctly.
856
+ */
857
+ get_transformation_orientation(): number;
858
+ /**
859
+ * Early width information.
860
+ *
861
+ * This information is often correct. However, it should only be used for
862
+ * an early rendering estimates. For everything else, the specific frame
863
+ * information should be used. See [method`Frame`.get_width].
864
+ * @returns Width
865
+ */
866
+ get_width(): number;
867
+ /**
868
+ * Synchronously loads texture and information of the next frame.
869
+ *
870
+ * For single still images, this can only be called once.
871
+ * For animated images, this function will loop to the first frame, when the last frame is reached.
872
+ * @returns a new [class@Frame] on success, or `NULL` with @error filled in
873
+ */
874
+ next_frame(): Frame;
875
+ /**
876
+ * Asynchronous version of [method`Image`.next_frame].
877
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
878
+ */
879
+ next_frame_async(cancellable?: Gio.Cancellable | null): globalThis.Promise<Frame>;
880
+ /**
881
+ * Asynchronous version of [method`Image`.next_frame].
882
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
883
+ * @param callback A callback to call when the operation is complete
884
+ */
885
+ next_frame_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
886
+ /**
887
+ * Asynchronous version of [method`Image`.next_frame].
888
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
889
+ * @param callback A callback to call when the operation is complete
890
+ */
891
+ next_frame_async(
892
+ cancellable?: Gio.Cancellable | null,
893
+ callback?: Gio.AsyncReadyCallback<this> | null,
894
+ ): globalThis.Promise<Frame> | void;
895
+ /**
896
+ * Finishes the [method`Image`.next_frame_async] call.
897
+ * @param result a `GAsyncResult`
898
+ * @returns Loaded frame.
899
+ */
900
+ next_frame_finish(result: Gio.AsyncResult): Frame;
901
+ }
902
+
903
+ namespace Loader {
904
+ // Signal signatures
905
+ interface SignalSignatures extends GObject.Object.SignalSignatures {
906
+ 'notify::apply-transformation': (pspec: GObject.ParamSpec) => void;
907
+ 'notify::bytes': (pspec: GObject.ParamSpec) => void;
908
+ 'notify::cancellable': (pspec: GObject.ParamSpec) => void;
909
+ 'notify::file': (pspec: GObject.ParamSpec) => void;
910
+ 'notify::memory-format-selection': (pspec: GObject.ParamSpec) => void;
911
+ 'notify::sandbox-selector': (pspec: GObject.ParamSpec) => void;
912
+ 'notify::stream': (pspec: GObject.ParamSpec) => void;
913
+ }
914
+
915
+ // Constructor properties interface
916
+
917
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
918
+ apply_transformation: boolean;
919
+ applyTransformation: boolean;
920
+ bytes: GLib.Bytes;
921
+ cancellable: Gio.Cancellable;
922
+ file: Gio.File;
923
+ memory_format_selection: MemoryFormatSelection;
924
+ memoryFormatSelection: MemoryFormatSelection;
925
+ sandbox_selector: SandboxSelector;
926
+ sandboxSelector: SandboxSelector;
927
+ stream: Gio.InputStream;
928
+ }
929
+ }
930
+
931
+ /**
932
+ * [class`Loader]` prepares loading an image.
933
+ *
934
+ * The following example shows how to obtain a `Gdk.Texture`. It uses
935
+ * [GlyGtk4](https://gnome.pages.gitlab.gnome.org/glycin/libglycin-gtk4)
936
+ * for this.
937
+ *
938
+ * ```c
939
+ * #include <glycin-gtk4.h>
940
+ *
941
+ * file = g_file_new_for_path ("test.png");
942
+ * loader = gly_loader_new (file);
943
+ * image = gly_loader_load (loader, NULL);
944
+ * if (image)
945
+ * {
946
+ * frame = gly_image_next_frame (image, NULL);
947
+ * if (frame) {
948
+ * texture = gly_gtk_frame_get_texture (frame);
949
+ * printf ("Image height: %d\n", gdk_texture_get_height (texture));
950
+ * image_widget = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
951
+ * }
952
+ * }
953
+ * ```
954
+ */
955
+ class Loader extends GObject.Object {
956
+ static $gtype: GObject.GType<Loader>;
957
+
958
+ // Properties
959
+
960
+ get apply_transformation(): boolean;
961
+ set apply_transformation(val: boolean);
962
+ get applyTransformation(): boolean;
963
+ set applyTransformation(val: boolean);
964
+ get bytes(): GLib.Bytes;
965
+ get cancellable(): Gio.Cancellable;
966
+ set cancellable(val: Gio.Cancellable);
967
+ get file(): Gio.File;
968
+ get memory_format_selection(): MemoryFormatSelection;
969
+ set memory_format_selection(val: MemoryFormatSelection);
970
+ get memoryFormatSelection(): MemoryFormatSelection;
971
+ set memoryFormatSelection(val: MemoryFormatSelection);
972
+ get sandbox_selector(): SandboxSelector;
973
+ set sandbox_selector(val: SandboxSelector);
974
+ get sandboxSelector(): SandboxSelector;
975
+ set sandboxSelector(val: SandboxSelector);
976
+ get stream(): Gio.InputStream;
977
+
978
+ /**
979
+ * Compile-time signal type information.
980
+ *
981
+ * This instance property is generated only for TypeScript type checking.
982
+ * It is not defined at runtime and should not be accessed in JS code.
983
+ * @internal
984
+ */
985
+ $signals: Loader.SignalSignatures;
986
+
987
+ // Constructors
988
+
989
+ constructor(properties?: Partial<Loader.ConstructorProps>, ...args: any[]);
990
+
991
+ _init(...args: any[]): void;
992
+
993
+ static ['new'](file: Gio.File): Loader;
994
+
995
+ static new_for_bytes(bytes: GLib.Bytes | Uint8Array): Loader;
996
+
997
+ static new_for_stream(stream: Gio.InputStream): Loader;
998
+
999
+ // Signals
1000
+
1001
+ connect<K extends keyof Loader.SignalSignatures>(
1002
+ signal: K,
1003
+ callback: GObject.SignalCallback<this, Loader.SignalSignatures[K]>,
1004
+ ): number;
1005
+ connect(signal: string, callback: (...args: any[]) => any): number;
1006
+ connect_after<K extends keyof Loader.SignalSignatures>(
1007
+ signal: K,
1008
+ callback: GObject.SignalCallback<this, Loader.SignalSignatures[K]>,
1009
+ ): number;
1010
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
1011
+ emit<K extends keyof Loader.SignalSignatures>(
1012
+ signal: K,
1013
+ ...args: GObject.GjsParameters<Loader.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
1014
+ ): void;
1015
+ emit(signal: string, ...args: any[]): void;
1016
+
1017
+ // Static methods
1018
+
1019
+ /**
1020
+ * Returns a list of MIME types currently supported for loading images.
1021
+ *
1022
+ * This list is generated from the config on first use of a loader or
1023
+ * call of this function and cached afterwards. Hence, the first call
1024
+ * can be blocking.
1025
+ */
1026
+ static get_mime_types(): string[];
1027
+ /**
1028
+ * Async variant of [func`Loader`.get_mime_types]
1029
+ * @param cancellable
1030
+ * @param callback
1031
+ */
1032
+ static get_mime_types_async(
1033
+ cancellable?: Gio.Cancellable | null,
1034
+ callback?: Gio.AsyncReadyCallback<Loader> | null,
1035
+ ): void;
1036
+ /**
1037
+ * Finishes the [func`Loader`.get_mime_types_async] call.
1038
+ * @param result A `GAsyncResult`
1039
+ */
1040
+ static get_mime_types_finish(result: Gio.AsyncResult): string[];
1041
+
1042
+ // Methods
1043
+
1044
+ /**
1045
+ * Synchronously loads an image and returns an [class`Image]` when successful.
1046
+ * @returns a new [class@Image] on success, or `NULL` with @error filled in
1047
+ */
1048
+ load(): Image;
1049
+ /**
1050
+ * Asynchronous version of [method`Loader`.load].
1051
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
1052
+ */
1053
+ load_async(cancellable?: Gio.Cancellable | null): globalThis.Promise<Image>;
1054
+ /**
1055
+ * Asynchronous version of [method`Loader`.load].
1056
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
1057
+ * @param callback A callback to call when the operation is complete
1058
+ */
1059
+ load_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
1060
+ /**
1061
+ * Asynchronous version of [method`Loader`.load].
1062
+ * @param cancellable A [class@Gio.Cancellable] to cancel the operation
1063
+ * @param callback A callback to call when the operation is complete
1064
+ */
1065
+ load_async(
1066
+ cancellable?: Gio.Cancellable | null,
1067
+ callback?: Gio.AsyncReadyCallback<this> | null,
1068
+ ): globalThis.Promise<Image> | void;
1069
+ /**
1070
+ * Finishes the [method`Loader`.load_async] call.
1071
+ * @param result A `GAsyncResult`
1072
+ * @returns Loaded image.
1073
+ */
1074
+ load_finish(result: Gio.AsyncResult): Image;
1075
+ /**
1076
+ * Sets which memory formats can be returned by the loader
1077
+ *
1078
+ * If the memory format doesn't match one of the selected formats, the
1079
+ * format will be transformed into the best suitable format selected.
1080
+ * @param memory_format_selection Accepted memory formats
1081
+ */
1082
+ set_accepted_memory_formats(memory_format_selection: MemoryFormatSelection | null): void;
1083
+ /**
1084
+ * Set whether to apply transformations to texture
1085
+ *
1086
+ * When enabled, transformations like image orientation are applied to the
1087
+ * texture data.
1088
+ *
1089
+ * This option is enabled by default.
1090
+ * @param apply_transformations
1091
+ */
1092
+ set_apply_transformations(apply_transformations: boolean): void;
1093
+ /**
1094
+ * Selects which sandbox mechanism should be used. The default without calling this function is [enum`SandboxSelector]``.AUTO`.
1095
+ * @param sandbox_selector Method by which the sandbox mechanism is selected
1096
+ */
1097
+ set_sandbox_selector(sandbox_selector: SandboxSelector | null): void;
1098
+ }
1099
+
1100
+ namespace NewFrame {
1101
+ // Signal signatures
1102
+ interface SignalSignatures extends GObject.Object.SignalSignatures {}
1103
+
1104
+ // Constructor properties interface
1105
+
1106
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
1107
+ }
1108
+
1109
+ /**
1110
+ * New frame
1111
+ */
1112
+ class NewFrame extends GObject.Object {
1113
+ static $gtype: GObject.GType<NewFrame>;
1114
+
1115
+ /**
1116
+ * Compile-time signal type information.
1117
+ *
1118
+ * This instance property is generated only for TypeScript type checking.
1119
+ * It is not defined at runtime and should not be accessed in JS code.
1120
+ * @internal
1121
+ */
1122
+ $signals: NewFrame.SignalSignatures;
1123
+
1124
+ // Constructors
1125
+
1126
+ constructor(properties?: Partial<NewFrame.ConstructorProps>, ...args: any[]);
1127
+
1128
+ _init(...args: any[]): void;
1129
+
1130
+ // Signals
1131
+
1132
+ connect<K extends keyof NewFrame.SignalSignatures>(
1133
+ signal: K,
1134
+ callback: GObject.SignalCallback<this, NewFrame.SignalSignatures[K]>,
1135
+ ): number;
1136
+ connect(signal: string, callback: (...args: any[]) => any): number;
1137
+ connect_after<K extends keyof NewFrame.SignalSignatures>(
1138
+ signal: K,
1139
+ callback: GObject.SignalCallback<this, NewFrame.SignalSignatures[K]>,
1140
+ ): number;
1141
+ connect_after(signal: string, callback: (...args: any[]) => any): number;
1142
+ emit<K extends keyof NewFrame.SignalSignatures>(
1143
+ signal: K,
1144
+ ...args: GObject.GjsParameters<NewFrame.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
1145
+ ): void;
1146
+ emit(signal: string, ...args: any[]): void;
1147
+
1148
+ // Methods
1149
+
1150
+ set_color_icc_profile(icc_profile: GLib.Bytes | Uint8Array): boolean;
1151
+ }
1152
+
1153
+ /**
1154
+ * See ITU-T H.273
1155
+ */
1156
+ class Cicp {
1157
+ static $gtype: GObject.GType<Cicp>;
1158
+
1159
+ // Fields
1160
+
1161
+ color_primaries: number;
1162
+ transfer_characteristics: number;
1163
+ matrix_coefficients: number;
1164
+ video_full_range_flag: number;
1165
+
1166
+ // Constructors
1167
+
1168
+ constructor(
1169
+ properties?: Partial<{
1170
+ color_primaries: number;
1171
+ transfer_characteristics: number;
1172
+ matrix_coefficients: number;
1173
+ video_full_range_flag: number;
1174
+ }>,
1175
+ );
1176
+ _init(...args: any[]): void;
1177
+
1178
+ // Methods
1179
+
1180
+ copy(): Cicp;
1181
+ free(): void;
1182
+ }
1183
+
1184
+ type CreatorClass = typeof Creator;
1185
+ type EncodedImageClass = typeof EncodedImage;
1186
+ type FrameClass = typeof Frame;
1187
+ type FrameRequestClass = typeof FrameRequest;
1188
+ type ImageClass = typeof Image;
1189
+ type LoaderClass = typeof Loader;
1190
+ type NewFrameClass = typeof NewFrame;
1191
+ /**
1192
+ * Name of the imported GIR library
1193
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
1194
+ */
1195
+ const __name__: string;
1196
+ /**
1197
+ * Version of the imported GIR library
1198
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
1199
+ */
1200
+ const __version__: string;
1201
+ }
1202
+
1203
+ export default Gly;
1204
+
1205
+ // END