@girs/gdkpixbuf-2.0 2.0.0-3.0.0-beta.12

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.
@@ -0,0 +1,2712 @@
1
+
2
+ /*
3
+ * Type Definitions for Gjs (https://gjs.guide/)
4
+ *
5
+ * These type definitions are automatically generated, do not edit them by hand.
6
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gjs
7
+ */
8
+ /**
9
+ * GdkPixbuf-2.0
10
+ */
11
+
12
+ import type Gio from '@girs/gio-2.0';
13
+ import type GObject from '@girs/gobject-2.0';
14
+ import type GLib from '@girs/glib-2.0';
15
+ import type GModule from '@girs/gmodule-2.0';
16
+
17
+ export namespace GdkPixbuf {
18
+
19
+ /**
20
+ * This enumeration defines the color spaces that are supported by
21
+ * the gdk-pixbuf library.
22
+ *
23
+ * Currently only RGB is supported.
24
+ */
25
+ enum Colorspace {
26
+ /**
27
+ * Indicates a red/green/blue additive color space.
28
+ */
29
+ RGB,
30
+ }
31
+ /**
32
+ * Interpolation modes for scaling functions.
33
+ *
34
+ * The `GDK_INTERP_NEAREST` mode is the fastest scaling method, but has
35
+ * horrible quality when scaling down; `GDK_INTERP_BILINEAR` is the best
36
+ * choice if you aren't sure what to choose, it has a good speed/quality
37
+ * balance.
38
+ *
39
+ * **Note**: Cubic filtering is missing from the list; hyperbolic
40
+ * interpolation is just as fast and results in higher quality.
41
+ */
42
+ enum InterpType {
43
+ /**
44
+ * Nearest neighbor sampling; this is the fastest
45
+ * and lowest quality mode. Quality is normally unacceptable when scaling
46
+ * down, but may be OK when scaling up.
47
+ */
48
+ NEAREST,
49
+ /**
50
+ * This is an accurate simulation of the PostScript
51
+ * image operator without any interpolation enabled. Each pixel is
52
+ * rendered as a tiny parallelogram of solid color, the edges of which
53
+ * are implemented with antialiasing. It resembles nearest neighbor for
54
+ * enlargement, and bilinear for reduction.
55
+ */
56
+ TILES,
57
+ /**
58
+ * Best quality/speed balance; use this mode by
59
+ * default. Bilinear interpolation. For enlargement, it is
60
+ * equivalent to point-sampling the ideal bilinear-interpolated image.
61
+ * For reduction, it is equivalent to laying down small tiles and
62
+ * integrating over the coverage area.
63
+ */
64
+ BILINEAR,
65
+ /**
66
+ * This is the slowest and highest quality
67
+ * reconstruction function. It is derived from the hyperbolic filters in
68
+ * Wolberg's "Digital Image Warping", and is formally defined as the
69
+ * hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
70
+ * image (the filter is designed to be idempotent for 1:1 pixel mapping).
71
+ * **Deprecated**: this interpolation filter is deprecated, as in reality
72
+ * it has a lower quality than the `GDK_INTERP_BILINEAR` filter
73
+ * (Since: 2.38)
74
+ */
75
+ HYPER,
76
+ }
77
+ /**
78
+ * Control the alpha channel for drawables.
79
+ *
80
+ * These values can be passed to gdk_pixbuf_xlib_render_to_drawable_alpha()
81
+ * in gdk-pixbuf-xlib to control how the alpha channel of an image should
82
+ * be handled.
83
+ *
84
+ * This function can create a bilevel clipping mask (black and white) and use
85
+ * it while painting the image.
86
+ *
87
+ * In the future, when the X Window System gets an alpha channel extension,
88
+ * it will be possible to do full alpha compositing onto arbitrary drawables.
89
+ * For now both cases fall back to a bilevel clipping mask.
90
+ */
91
+ enum PixbufAlphaMode {
92
+ /**
93
+ * A bilevel clipping mask (black and white)
94
+ * will be created and used to draw the image. Pixels below 0.5 opacity
95
+ * will be considered fully transparent, and all others will be
96
+ * considered fully opaque.
97
+ */
98
+ BILEVEL,
99
+ /**
100
+ * For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
101
+ * In the future it will do full alpha compositing.
102
+ */
103
+ FULL,
104
+ }
105
+ /**
106
+ * An error code in the `GDK_PIXBUF_ERROR` domain.
107
+ *
108
+ * Many gdk-pixbuf operations can cause errors in this domain, or in
109
+ * the `G_FILE_ERROR` domain.
110
+ */
111
+ enum PixbufError {
112
+ /**
113
+ * An image file was broken somehow.
114
+ */
115
+ CORRUPT_IMAGE,
116
+ /**
117
+ * Not enough memory.
118
+ */
119
+ INSUFFICIENT_MEMORY,
120
+ /**
121
+ * A bad option was passed to a pixbuf save module.
122
+ */
123
+ BAD_OPTION,
124
+ /**
125
+ * Unknown image type.
126
+ */
127
+ UNKNOWN_TYPE,
128
+ /**
129
+ * Don't know how to perform the
130
+ * given operation on the type of image at hand.
131
+ */
132
+ UNSUPPORTED_OPERATION,
133
+ /**
134
+ * Generic failure code, something went wrong.
135
+ */
136
+ FAILED,
137
+ /**
138
+ * Only part of the animation was loaded.
139
+ */
140
+ INCOMPLETE_ANIMATION,
141
+ }
142
+ /**
143
+ * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
144
+ *
145
+ * To make them easier to use, their numerical values are the actual degrees.
146
+ */
147
+ enum PixbufRotation {
148
+ /**
149
+ * No rotation.
150
+ */
151
+ NONE,
152
+ /**
153
+ * Rotate by 90 degrees.
154
+ */
155
+ COUNTERCLOCKWISE,
156
+ /**
157
+ * Rotate by 180 degrees.
158
+ */
159
+ UPSIDEDOWN,
160
+ /**
161
+ * Rotate by 270 degrees.
162
+ */
163
+ CLOCKWISE,
164
+ }
165
+ /**
166
+ * Flags which allow a module to specify further details about the supported
167
+ * operations.
168
+ * @bitfield
169
+ */
170
+ enum PixbufFormatFlags {
171
+ /**
172
+ * the module can write out images in the format.
173
+ */
174
+ WRITABLE,
175
+ /**
176
+ * the image format is scalable
177
+ */
178
+ SCALABLE,
179
+ /**
180
+ * the module is threadsafe. gdk-pixbuf
181
+ * ignores modules that are not marked as threadsafe. (Since 2.28).
182
+ */
183
+ THREADSAFE,
184
+ }
185
+ /**
186
+ * Major version of gdk-pixbuf library, that is the "0" in
187
+ * "0.8.2" for example.
188
+ */
189
+ const PIXBUF_MAJOR: number
190
+ /**
191
+ * Micro version of gdk-pixbuf library, that is the "2" in
192
+ * "0.8.2" for example.
193
+ */
194
+ const PIXBUF_MICRO: number
195
+ /**
196
+ * Minor version of gdk-pixbuf library, that is the "8" in
197
+ * "0.8.2" for example.
198
+ */
199
+ const PIXBUF_MINOR: number
200
+ /**
201
+ * Contains the full version of GdkPixbuf as a string.
202
+ *
203
+ * This is the version being compiled against; contrast with
204
+ * `gdk_pixbuf_version`.
205
+ */
206
+ const PIXBUF_VERSION: string | null
207
+ function pixbuf_error_quark(): GLib.Quark
208
+ /**
209
+ * A function of this type is responsible for freeing the pixel array
210
+ * of a pixbuf.
211
+ *
212
+ * The gdk_pixbuf_new_from_data() function lets you pass in a pre-allocated
213
+ * pixel array so that a pixbuf can be created from it; in this case you
214
+ * will need to pass in a function of type `GdkPixbufDestroyNotify` so that
215
+ * the pixel data can be freed when the pixbuf is finalized.
216
+ * @callback
217
+ * @param pixels The pixel array of the pixbuf that is being finalized.
218
+ */
219
+ interface PixbufDestroyNotify {
220
+ (pixels: Uint8Array): void
221
+ }
222
+ /**
223
+ * Defines the type of the function used to fill a
224
+ * #GdkPixbufFormat structure with information about a module.
225
+ * @callback
226
+ * @param info a #GdkPixbufFormat.
227
+ */
228
+ interface PixbufModuleFillInfoFunc {
229
+ (info: PixbufFormat): void
230
+ }
231
+ /**
232
+ * Defines the type of the function used to set the vtable of a
233
+ * #GdkPixbufModule when it is loaded.
234
+ * @callback
235
+ * @param module a #GdkPixbufModule.
236
+ */
237
+ interface PixbufModuleFillVtableFunc {
238
+ (module: PixbufModule): void
239
+ }
240
+ /**
241
+ * Defines the type of the function that gets called once the initial
242
+ * setup of `pixbuf` is done.
243
+ *
244
+ * #GdkPixbufLoader uses a function of this type to emit the
245
+ * "<link linkend="GdkPixbufLoader-area-prepared">area_prepared</link>"
246
+ * signal.
247
+ * @callback
248
+ * @param pixbuf the #GdkPixbuf that is currently being loaded.
249
+ * @param anim if an animation is being loaded, the #GdkPixbufAnimation, else %NULL.
250
+ */
251
+ interface PixbufModulePreparedFunc {
252
+ (pixbuf: Pixbuf, anim: PixbufAnimation): void
253
+ }
254
+ /**
255
+ * Defines the type of the function that gets called once the size
256
+ * of the loaded image is known.
257
+ *
258
+ * The function is expected to set `width` and `height` to the desired
259
+ * size to which the image should be scaled. If a module has no efficient
260
+ * way to achieve the desired scaling during the loading of the image, it may
261
+ * either ignore the size request, or only approximate it - gdk-pixbuf will
262
+ * then perform the required scaling on the completely loaded image.
263
+ *
264
+ * If the function sets `width` or `height` to zero, the module should interpret
265
+ * this as a hint that it will be closed soon and shouldn't allocate further
266
+ * resources. This convention is used to implement gdk_pixbuf_get_file_info()
267
+ * efficiently.
268
+ * @callback
269
+ * @param width pointer to a location containing the current image width
270
+ * @param height pointer to a location containing the current image height
271
+ */
272
+ interface PixbufModuleSizeFunc {
273
+ (width: number, height: number): void
274
+ }
275
+ /**
276
+ * Defines the type of the function that gets called every time a region
277
+ * of `pixbuf` is updated.
278
+ *
279
+ * #GdkPixbufLoader uses a function of this type to emit the
280
+ * "<link linkend="GdkPixbufLoader-area-updated">area_updated</link>"
281
+ * signal.
282
+ * @callback
283
+ * @param pixbuf the #GdkPixbuf that is currently being loaded.
284
+ * @param x the X origin of the updated area.
285
+ * @param y the Y origin of the updated area.
286
+ * @param width the width of the updated area.
287
+ * @param height the height of the updated area.
288
+ */
289
+ interface PixbufModuleUpdatedFunc {
290
+ (pixbuf: Pixbuf, x: number, y: number, width: number, height: number): void
291
+ }
292
+ /**
293
+ * Save functions used by [method`GdkPixbuf`.Pixbuf.save_to_callback].
294
+ *
295
+ * This function is called once for each block of bytes that is "written"
296
+ * by `gdk_pixbuf_save_to_callback()`.
297
+ *
298
+ * If successful it should return `TRUE`; if an error occurs it should set
299
+ * `error` and return `FALSE`, in which case `gdk_pixbuf_save_to_callback()`
300
+ * will fail with the same error.
301
+ * @callback
302
+ * @param buf bytes to be written.
303
+ * @returns `TRUE` if successful, `FALSE` otherwise
304
+ */
305
+ interface PixbufSaveFunc {
306
+ (buf: Uint8Array): boolean
307
+ }
308
+ module Pixbuf {
309
+
310
+ // Constructor properties interface
311
+
312
+ interface ConstructorProperties extends Gio.Icon.ConstructorProperties, Gio.LoadableIcon.ConstructorProperties, GObject.Object.ConstructorProperties {
313
+
314
+ // Own constructor properties of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
315
+
316
+ /**
317
+ * The number of bits per sample.
318
+ *
319
+ * Currently only 8 bit per sample are supported.
320
+ */
321
+ bits_per_sample?: number | null
322
+ /**
323
+ * The color space of the pixbuf.
324
+ *
325
+ * Currently, only `GDK_COLORSPACE_RGB` is supported.
326
+ */
327
+ colorspace?: Colorspace | null
328
+ /**
329
+ * Whether the pixbuf has an alpha channel.
330
+ */
331
+ has_alpha?: boolean | null
332
+ /**
333
+ * The number of rows of the pixbuf.
334
+ */
335
+ height?: number | null
336
+ /**
337
+ * The number of samples per pixel.
338
+ *
339
+ * Currently, only 3 or 4 samples per pixel are supported.
340
+ */
341
+ n_channels?: number | null
342
+ pixel_bytes?: GLib.Bytes | null
343
+ /**
344
+ * A pointer to the pixel data of the pixbuf.
345
+ */
346
+ pixels?: any | null
347
+ /**
348
+ * The number of bytes between the start of a row and
349
+ * the start of the next row.
350
+ *
351
+ * This number must (obviously) be at least as large as the
352
+ * width of the pixbuf.
353
+ */
354
+ rowstride?: number | null
355
+ /**
356
+ * The number of columns of the pixbuf.
357
+ */
358
+ width?: number | null
359
+ }
360
+
361
+ }
362
+
363
+ interface Pixbuf extends Gio.Icon, Gio.LoadableIcon {
364
+
365
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
366
+
367
+ /**
368
+ * The number of bits per sample.
369
+ *
370
+ * Currently only 8 bit per sample are supported.
371
+ */
372
+ readonly bits_per_sample: number
373
+ /**
374
+ * The color space of the pixbuf.
375
+ *
376
+ * Currently, only `GDK_COLORSPACE_RGB` is supported.
377
+ */
378
+ readonly colorspace: Colorspace
379
+ /**
380
+ * Whether the pixbuf has an alpha channel.
381
+ */
382
+ readonly has_alpha: boolean
383
+ /**
384
+ * The number of rows of the pixbuf.
385
+ */
386
+ readonly height: number
387
+ /**
388
+ * The number of samples per pixel.
389
+ *
390
+ * Currently, only 3 or 4 samples per pixel are supported.
391
+ */
392
+ readonly n_channels: number
393
+ readonly pixel_bytes: GLib.Bytes
394
+ /**
395
+ * A pointer to the pixel data of the pixbuf.
396
+ */
397
+ readonly pixels: any
398
+ /**
399
+ * The number of bytes between the start of a row and
400
+ * the start of the next row.
401
+ *
402
+ * This number must (obviously) be at least as large as the
403
+ * width of the pixbuf.
404
+ */
405
+ readonly rowstride: number
406
+ /**
407
+ * The number of columns of the pixbuf.
408
+ */
409
+ readonly width: number
410
+
411
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
412
+
413
+ /**
414
+ * Takes an existing pixbuf and adds an alpha channel to it.
415
+ *
416
+ * If the existing pixbuf already had an alpha channel, the channel
417
+ * values are copied from the original; otherwise, the alpha channel
418
+ * is initialized to 255 (full opacity).
419
+ *
420
+ * If `substitute_color` is `TRUE`, then the color specified by the
421
+ * (`r`, `g`, `b`) arguments will be assigned zero opacity. That is,
422
+ * if you pass `(255, 255, 255)` for the substitute color, all white
423
+ * pixels will become fully transparent.
424
+ *
425
+ * If `substitute_color` is `FALSE`, then the (`r`, `g`, `b`) arguments
426
+ * will be ignored.
427
+ * @param substitute_color Whether to set a color to zero opacity.
428
+ * @param r Red value to substitute.
429
+ * @param g Green value to substitute.
430
+ * @param b Blue value to substitute.
431
+ * @returns A newly-created pixbuf
432
+ */
433
+ add_alpha(substitute_color: boolean, r: number, g: number, b: number): Pixbuf
434
+ /**
435
+ * Takes an existing pixbuf and checks for the presence of an
436
+ * associated "orientation" option.
437
+ *
438
+ * The orientation option may be provided by the JPEG loader (which
439
+ * reads the exif orientation tag) or the TIFF loader (which reads
440
+ * the TIFF orientation tag, and compensates it for the partial
441
+ * transforms performed by libtiff).
442
+ *
443
+ * If an orientation option/tag is present, the appropriate transform
444
+ * will be performed so that the pixbuf is oriented correctly.
445
+ * @returns A newly-created pixbuf
446
+ */
447
+ apply_embedded_orientation(): Pixbuf | null
448
+ /**
449
+ * Creates a transformation of the source image `src` by scaling by
450
+ * `scale_x` and `scale_y` then translating by `offset_x` and `offset_y`.
451
+ *
452
+ * This gives an image in the coordinates of the destination pixbuf.
453
+ * The rectangle (`dest_x,` `dest_y,` `dest_width,` `dest_height)`
454
+ * is then alpha blended onto the corresponding rectangle of the
455
+ * original destination image.
456
+ *
457
+ * When the destination rectangle contains parts not in the source
458
+ * image, the data at the edges of the source image is replicated
459
+ * to infinity.
460
+ *
461
+ * ![](composite.png)
462
+ * @param dest the #GdkPixbuf into which to render the results
463
+ * @param dest_x the left coordinate for region to render
464
+ * @param dest_y the top coordinate for region to render
465
+ * @param dest_width the width of the region to render
466
+ * @param dest_height the height of the region to render
467
+ * @param offset_x the offset in the X direction (currently rounded to an integer)
468
+ * @param offset_y the offset in the Y direction (currently rounded to an integer)
469
+ * @param scale_x the scale factor in the X direction
470
+ * @param scale_y the scale factor in the Y direction
471
+ * @param interp_type the interpolation type for the transformation.
472
+ * @param overall_alpha overall alpha for source image (0..255)
473
+ */
474
+ composite(dest: Pixbuf, dest_x: number, dest_y: number, dest_width: number, dest_height: number, offset_x: number, offset_y: number, scale_x: number, scale_y: number, interp_type: InterpType, overall_alpha: number): void
475
+ /**
476
+ * Creates a transformation of the source image `src` by scaling by
477
+ * `scale_x` and `scale_y` then translating by `offset_x` and `offset_y,`
478
+ * then alpha blends the rectangle (`dest_x` ,`dest_y,` `dest_width,`
479
+ * `dest_height)` of the resulting image with a checkboard of the
480
+ * colors `color1` and `color2` and renders it onto the destination
481
+ * image.
482
+ *
483
+ * If the source image has no alpha channel, and `overall_alpha` is 255, a fast
484
+ * path is used which omits the alpha blending and just performs the scaling.
485
+ *
486
+ * See gdk_pixbuf_composite_color_simple() for a simpler variant of this
487
+ * function suitable for many tasks.
488
+ * @param dest the #GdkPixbuf into which to render the results
489
+ * @param dest_x the left coordinate for region to render
490
+ * @param dest_y the top coordinate for region to render
491
+ * @param dest_width the width of the region to render
492
+ * @param dest_height the height of the region to render
493
+ * @param offset_x the offset in the X direction (currently rounded to an integer)
494
+ * @param offset_y the offset in the Y direction (currently rounded to an integer)
495
+ * @param scale_x the scale factor in the X direction
496
+ * @param scale_y the scale factor in the Y direction
497
+ * @param interp_type the interpolation type for the transformation.
498
+ * @param overall_alpha overall alpha for source image (0..255)
499
+ * @param check_x the X offset for the checkboard (origin of checkboard is at -`check_x,` -`check_y)`
500
+ * @param check_y the Y offset for the checkboard
501
+ * @param check_size the size of checks in the checkboard (must be a power of two)
502
+ * @param color1 the color of check at upper left
503
+ * @param color2 the color of the other check
504
+ */
505
+ composite_color(dest: Pixbuf, dest_x: number, dest_y: number, dest_width: number, dest_height: number, offset_x: number, offset_y: number, scale_x: number, scale_y: number, interp_type: InterpType, overall_alpha: number, check_x: number, check_y: number, check_size: number, color1: number, color2: number): void
506
+ /**
507
+ * Creates a new pixbuf by scaling `src` to `dest_width` x `dest_height`
508
+ * and alpha blending the result with a checkboard of colors `color1`
509
+ * and `color2`.
510
+ * @param dest_width the width of destination image
511
+ * @param dest_height the height of destination image
512
+ * @param interp_type the interpolation type for the transformation.
513
+ * @param overall_alpha overall alpha for source image (0..255)
514
+ * @param check_size the size of checks in the checkboard (must be a power of two)
515
+ * @param color1 the color of check at upper left
516
+ * @param color2 the color of the other check
517
+ * @returns the new pixbuf
518
+ */
519
+ composite_color_simple(dest_width: number, dest_height: number, interp_type: InterpType, overall_alpha: number, check_size: number, color1: number, color2: number): Pixbuf | null
520
+ /**
521
+ * Creates a new `GdkPixbuf` with a copy of the information in the specified
522
+ * `pixbuf`.
523
+ *
524
+ * Note that this does not copy the options set on the original `GdkPixbuf`,
525
+ * use gdk_pixbuf_copy_options() for this.
526
+ * @returns A newly-created pixbuf
527
+ */
528
+ copy(): Pixbuf | null
529
+ /**
530
+ * Copies a rectangular area from `src_pixbuf` to `dest_pixbuf`.
531
+ *
532
+ * Conversion of pixbuf formats is done automatically.
533
+ *
534
+ * If the source rectangle overlaps the destination rectangle on the
535
+ * same pixbuf, it will be overwritten during the copy operation.
536
+ * Therefore, you can not use this function to scroll a pixbuf.
537
+ * @param src_x Source X coordinate within `src_pixbuf`.
538
+ * @param src_y Source Y coordinate within `src_pixbuf`.
539
+ * @param width Width of the area to copy.
540
+ * @param height Height of the area to copy.
541
+ * @param dest_pixbuf Destination pixbuf.
542
+ * @param dest_x X coordinate within `dest_pixbuf`.
543
+ * @param dest_y Y coordinate within `dest_pixbuf`.
544
+ */
545
+ copy_area(src_x: number, src_y: number, width: number, height: number, dest_pixbuf: Pixbuf, dest_x: number, dest_y: number): void
546
+ /**
547
+ * Copies the key/value pair options attached to a `GdkPixbuf` to another
548
+ * `GdkPixbuf`.
549
+ *
550
+ * This is useful to keep original metadata after having manipulated
551
+ * a file. However be careful to remove metadata which you've already
552
+ * applied, such as the "orientation" option after rotating the image.
553
+ * @param dest_pixbuf the destination pixbuf
554
+ * @returns `TRUE` on success.
555
+ */
556
+ copy_options(dest_pixbuf: Pixbuf): boolean
557
+ /**
558
+ * Clears a pixbuf to the given RGBA value, converting the RGBA value into
559
+ * the pixbuf's pixel format.
560
+ *
561
+ * The alpha component will be ignored if the pixbuf doesn't have an alpha
562
+ * channel.
563
+ * @param pixel RGBA pixel to used to clear (`0xffffffff` is opaque white, `0x00000000` transparent black)
564
+ */
565
+ fill(pixel: number): void
566
+ /**
567
+ * Flips a pixbuf horizontally or vertically and returns the
568
+ * result in a new pixbuf.
569
+ * @param horizontal `TRUE` to flip horizontally, `FALSE` to flip vertically
570
+ * @returns the new pixbuf
571
+ */
572
+ flip(horizontal: boolean): Pixbuf | null
573
+ /**
574
+ * Queries the number of bits per color sample in a pixbuf.
575
+ * @returns Number of bits per color sample.
576
+ */
577
+ get_bits_per_sample(): number
578
+ /**
579
+ * Returns the length of the pixel data, in bytes.
580
+ * @returns The length of the pixel data.
581
+ */
582
+ get_byte_length(): number
583
+ /**
584
+ * Queries the color space of a pixbuf.
585
+ * @returns Color space.
586
+ */
587
+ get_colorspace(): Colorspace
588
+ /**
589
+ * Queries whether a pixbuf has an alpha channel (opacity information).
590
+ * @returns `TRUE` if it has an alpha channel, `FALSE` otherwise.
591
+ */
592
+ get_has_alpha(): boolean
593
+ /**
594
+ * Queries the height of a pixbuf.
595
+ * @returns Height in pixels.
596
+ */
597
+ get_height(): number
598
+ /**
599
+ * Queries the number of channels of a pixbuf.
600
+ * @returns Number of channels.
601
+ */
602
+ get_n_channels(): number
603
+ /**
604
+ * Looks up `key` in the list of options that may have been attached to the
605
+ * `pixbuf` when it was loaded, or that may have been attached by another
606
+ * function using gdk_pixbuf_set_option().
607
+ *
608
+ * For instance, the ANI loader provides "Title" and "Artist" options.
609
+ * The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
610
+ * options for cursor definitions. The PNG loader provides the tEXt ancillary
611
+ * chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
612
+ * return an "orientation" option string that corresponds to the embedded
613
+ * TIFF/Exif orientation tag (if present). Since 2.32, the TIFF loader sets
614
+ * the "multipage" option string to "yes" when a multi-page TIFF is loaded.
615
+ * Since 2.32 the JPEG and PNG loaders set "x-dpi" and "y-dpi" if the file
616
+ * contains image density information in dots per inch.
617
+ * Since 2.36.6, the JPEG loader sets the "comment" option with the comment
618
+ * EXIF tag.
619
+ * @param key a nul-terminated string.
620
+ * @returns the value associated with `key`
621
+ */
622
+ get_option(key: string | null): string | null
623
+ /**
624
+ * Returns a `GHashTable` with a list of all the options that may have been
625
+ * attached to the `pixbuf` when it was loaded, or that may have been
626
+ * attached by another function using [method`GdkPixbuf`.Pixbuf.set_option].
627
+ * @returns a #GHashTable of key/values pairs
628
+ */
629
+ get_options(): GLib.HashTable
630
+ /**
631
+ * Queries a pointer to the pixel data of a pixbuf.
632
+ *
633
+ * This function will cause an implicit copy of the pixbuf data if the
634
+ * pixbuf was created from read-only data.
635
+ *
636
+ * Please see the section on [image data](class.Pixbuf.html#image-data) for information
637
+ * about how the pixel data is stored in memory.
638
+ * @returns A pointer to the pixbuf's pixel data.
639
+ */
640
+ get_pixels(): Uint8Array
641
+ /**
642
+ * Queries the rowstride of a pixbuf, which is the number of bytes between
643
+ * the start of a row and the start of the next row.
644
+ * @returns Distance between row starts.
645
+ */
646
+ get_rowstride(): number
647
+ /**
648
+ * Queries the width of a pixbuf.
649
+ * @returns Width in pixels.
650
+ */
651
+ get_width(): number
652
+ /**
653
+ * Creates a new pixbuf which represents a sub-region of `src_pixbuf`.
654
+ *
655
+ * The new pixbuf shares its pixels with the original pixbuf, so
656
+ * writing to one affects both. The new pixbuf holds a reference to
657
+ * `src_pixbuf`, so `src_pixbuf` will not be finalized until the new
658
+ * pixbuf is finalized.
659
+ *
660
+ * Note that if `src_pixbuf` is read-only, this function will force it
661
+ * to be mutable.
662
+ * @param src_x X coord in `src_pixbuf`
663
+ * @param src_y Y coord in `src_pixbuf`
664
+ * @param width width of region in `src_pixbuf`
665
+ * @param height height of region in `src_pixbuf`
666
+ * @returns a new pixbuf
667
+ */
668
+ new_subpixbuf(src_x: number, src_y: number, width: number, height: number): Pixbuf
669
+ /**
670
+ * Provides a #GBytes buffer containing the raw pixel data; the data
671
+ * must not be modified.
672
+ *
673
+ * This function allows skipping the implicit copy that must be made
674
+ * if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.
675
+ * @returns A new reference to a read-only copy of the pixel data. Note that for mutable pixbufs, this function will incur a one-time copy of the pixel data for conversion into the returned #GBytes.
676
+ */
677
+ read_pixel_bytes(): GLib.Bytes
678
+ /**
679
+ * Provides a read-only pointer to the raw pixel data.
680
+ *
681
+ * This function allows skipping the implicit copy that must be made
682
+ * if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.
683
+ * @returns a read-only pointer to the raw pixel data
684
+ */
685
+ read_pixels(): number
686
+ /**
687
+ * Removes the key/value pair option attached to a `GdkPixbuf`.
688
+ * @param key a nul-terminated string representing the key to remove.
689
+ * @returns `TRUE` if an option was removed, `FALSE` if not.
690
+ */
691
+ remove_option(key: string | null): boolean
692
+ /**
693
+ * Rotates a pixbuf by a multiple of 90 degrees, and returns the
694
+ * result in a new pixbuf.
695
+ *
696
+ * If `angle` is 0, this function will return a copy of `src`.
697
+ * @param angle the angle to rotate by
698
+ * @returns the new pixbuf
699
+ */
700
+ rotate_simple(angle: PixbufRotation): Pixbuf | null
701
+ /**
702
+ * Modifies saturation and optionally pixelates `src`, placing the result in
703
+ * `dest`.
704
+ *
705
+ * The `src` and `dest` pixbufs must have the same image format, size, and
706
+ * rowstride.
707
+ *
708
+ * The `src` and `dest` arguments may be the same pixbuf with no ill effects.
709
+ *
710
+ * If `saturation` is 1.0 then saturation is not changed. If it's less than 1.0,
711
+ * saturation is reduced (the image turns toward grayscale); if greater than
712
+ * 1.0, saturation is increased (the image gets more vivid colors).
713
+ *
714
+ * If `pixelate` is `TRUE`, then pixels are faded in a checkerboard pattern to
715
+ * create a pixelated image.
716
+ * @param dest place to write modified version of `src`
717
+ * @param saturation saturation factor
718
+ * @param pixelate whether to pixelate
719
+ */
720
+ saturate_and_pixelate(dest: Pixbuf, saturation: number, pixelate: boolean): void
721
+ /**
722
+ * Vector version of `gdk_pixbuf_save_to_buffer()`.
723
+ *
724
+ * Saves pixbuf to a new buffer in format `type,` which is currently "jpeg",
725
+ * "tiff", "png", "ico" or "bmp".
726
+ *
727
+ * See [method`GdkPixbuf`.Pixbuf.save_to_buffer] for more details.
728
+ * @param type name of file format.
729
+ * @param option_keys name of options to set
730
+ * @param option_values values for named options
731
+ * @returns whether an error was set
732
+ */
733
+ save_to_bufferv(type: string | null, option_keys: string[] | null, option_values: string[] | null): [ /* returnType */ boolean, /* buffer */ Uint8Array ]
734
+ /**
735
+ * Vector version of `gdk_pixbuf_save_to_callback()`.
736
+ *
737
+ * Saves pixbuf to a callback in format `type,` which is currently "jpeg",
738
+ * "png", "tiff", "ico" or "bmp".
739
+ *
740
+ * If `error` is set, `FALSE` will be returned.
741
+ *
742
+ * See [method`GdkPixbuf`.Pixbuf.save_to_callback] for more details.
743
+ * @param save_func a function that is called to save each block of data that the save routine generates.
744
+ * @param type name of file format.
745
+ * @param option_keys name of options to set
746
+ * @param option_values values for named options
747
+ * @returns whether an error was set
748
+ */
749
+ save_to_callbackv(save_func: PixbufSaveFunc, type: string | null, option_keys: string[] | null, option_values: string[] | null): boolean
750
+ /**
751
+ * Saves `pixbuf` to an output stream.
752
+ *
753
+ * Supported file formats are currently "jpeg", "tiff", "png", "ico" or
754
+ * "bmp".
755
+ *
756
+ * See [method`GdkPixbuf`.Pixbuf.save_to_stream] for more details.
757
+ * @param stream a `GOutputStream` to save the pixbuf to
758
+ * @param type name of file format
759
+ * @param option_keys name of options to set
760
+ * @param option_values values for named options
761
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
762
+ * @returns `TRUE` if the pixbuf was saved successfully, `FALSE` if an error was set.
763
+ */
764
+ save_to_streamv(stream: Gio.OutputStream, type: string | null, option_keys: string[] | null, option_values: string[] | null, cancellable: Gio.Cancellable | null): boolean
765
+ /**
766
+ * Saves `pixbuf` to an output stream asynchronously.
767
+ *
768
+ * For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous
769
+ * version of this function.
770
+ *
771
+ * When the operation is finished, `callback` will be called in the main thread.
772
+ *
773
+ * You can then call gdk_pixbuf_save_to_stream_finish() to get the result of
774
+ * the operation.
775
+ * @param stream a `GOutputStream` to which to save the pixbuf
776
+ * @param type name of file format
777
+ * @param option_keys name of options to set
778
+ * @param option_values values for named options
779
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
780
+ * @param callback a `GAsyncReadyCallback` to call when the pixbuf is saved
781
+ */
782
+ save_to_streamv_async(stream: Gio.OutputStream, type: string | null, option_keys: string[] | null, option_values: string[] | null, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void
783
+ /**
784
+ * Vector version of `gdk_pixbuf_save()`.
785
+ *
786
+ * Saves pixbuf to a file in `type`, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
787
+ *
788
+ * If `error` is set, `FALSE` will be returned.
789
+ *
790
+ * See [method`GdkPixbuf`.Pixbuf.save] for more details.
791
+ * @param filename name of file to save.
792
+ * @param type name of file format.
793
+ * @param option_keys name of options to set
794
+ * @param option_values values for named options
795
+ * @returns whether an error was set
796
+ */
797
+ savev(filename: string, type: string | null, option_keys: string[] | null, option_values: string[] | null): boolean
798
+ /**
799
+ * Creates a transformation of the source image `src` by scaling by
800
+ * `scale_x` and `scale_y` then translating by `offset_x` and `offset_y,`
801
+ * then renders the rectangle (`dest_x,` `dest_y,` `dest_width,`
802
+ * `dest_height)` of the resulting image onto the destination image
803
+ * replacing the previous contents.
804
+ *
805
+ * Try to use gdk_pixbuf_scale_simple() first; this function is
806
+ * the industrial-strength power tool you can fall back to, if
807
+ * gdk_pixbuf_scale_simple() isn't powerful enough.
808
+ *
809
+ * If the source rectangle overlaps the destination rectangle on the
810
+ * same pixbuf, it will be overwritten during the scaling which
811
+ * results in rendering artifacts.
812
+ * @param dest the #GdkPixbuf into which to render the results
813
+ * @param dest_x the left coordinate for region to render
814
+ * @param dest_y the top coordinate for region to render
815
+ * @param dest_width the width of the region to render
816
+ * @param dest_height the height of the region to render
817
+ * @param offset_x the offset in the X direction (currently rounded to an integer)
818
+ * @param offset_y the offset in the Y direction (currently rounded to an integer)
819
+ * @param scale_x the scale factor in the X direction
820
+ * @param scale_y the scale factor in the Y direction
821
+ * @param interp_type the interpolation type for the transformation.
822
+ */
823
+ scale(dest: Pixbuf, dest_x: number, dest_y: number, dest_width: number, dest_height: number, offset_x: number, offset_y: number, scale_x: number, scale_y: number, interp_type: InterpType): void
824
+ /**
825
+ * Create a new pixbuf containing a copy of `src` scaled to
826
+ * `dest_width` x `dest_height`.
827
+ *
828
+ * This function leaves `src` unaffected.
829
+ *
830
+ * The `interp_type` should be `GDK_INTERP_NEAREST` if you want maximum
831
+ * speed (but when scaling down `GDK_INTERP_NEAREST` is usually unusably
832
+ * ugly). The default `interp_type` should be `GDK_INTERP_BILINEAR` which
833
+ * offers reasonable quality and speed.
834
+ *
835
+ * You can scale a sub-portion of `src` by creating a sub-pixbuf
836
+ * pointing into `src`; see [method`GdkPixbuf`.Pixbuf.new_subpixbuf].
837
+ *
838
+ * If `dest_width` and `dest_height` are equal to the width and height of
839
+ * `src`, this function will return an unscaled copy of `src`.
840
+ *
841
+ * For more complicated scaling/alpha blending see [method`GdkPixbuf`.Pixbuf.scale]
842
+ * and [method`GdkPixbuf`.Pixbuf.composite].
843
+ * @param dest_width the width of destination image
844
+ * @param dest_height the height of destination image
845
+ * @param interp_type the interpolation type for the transformation.
846
+ * @returns the new pixbuf
847
+ */
848
+ scale_simple(dest_width: number, dest_height: number, interp_type: InterpType): Pixbuf | null
849
+ /**
850
+ * Attaches a key/value pair as an option to a `GdkPixbuf`.
851
+ *
852
+ * If `key` already exists in the list of options attached to the `pixbuf`,
853
+ * the new value is ignored and `FALSE` is returned.
854
+ * @param key a nul-terminated string.
855
+ * @param value a nul-terminated string.
856
+ * @returns `TRUE` on success
857
+ */
858
+ set_option(key: string | null, value: string | null): boolean
859
+
860
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
861
+
862
+ connect(sigName: "notify::bits-per-sample", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
863
+ connect_after(sigName: "notify::bits-per-sample", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
864
+ emit(sigName: "notify::bits-per-sample", ...args: any[]): void
865
+ connect(sigName: "notify::colorspace", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
866
+ connect_after(sigName: "notify::colorspace", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
867
+ emit(sigName: "notify::colorspace", ...args: any[]): void
868
+ connect(sigName: "notify::has-alpha", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
869
+ connect_after(sigName: "notify::has-alpha", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
870
+ emit(sigName: "notify::has-alpha", ...args: any[]): void
871
+ connect(sigName: "notify::height", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
872
+ connect_after(sigName: "notify::height", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
873
+ emit(sigName: "notify::height", ...args: any[]): void
874
+ connect(sigName: "notify::n-channels", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
875
+ connect_after(sigName: "notify::n-channels", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
876
+ emit(sigName: "notify::n-channels", ...args: any[]): void
877
+ connect(sigName: "notify::pixel-bytes", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
878
+ connect_after(sigName: "notify::pixel-bytes", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
879
+ emit(sigName: "notify::pixel-bytes", ...args: any[]): void
880
+ connect(sigName: "notify::pixels", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
881
+ connect_after(sigName: "notify::pixels", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
882
+ emit(sigName: "notify::pixels", ...args: any[]): void
883
+ connect(sigName: "notify::rowstride", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
884
+ connect_after(sigName: "notify::rowstride", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
885
+ emit(sigName: "notify::rowstride", ...args: any[]): void
886
+ connect(sigName: "notify::width", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
887
+ connect_after(sigName: "notify::width", callback: (($obj: Pixbuf, pspec: GObject.ParamSpec) => void)): number
888
+ emit(sigName: "notify::width", ...args: any[]): void
889
+ connect(sigName: string, callback: (...args: any[]) => void): number
890
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
891
+ emit(sigName: string, ...args: any[]): void
892
+ disconnect(id: number): void
893
+ }
894
+
895
+ /**
896
+ * A pixel buffer.
897
+ *
898
+ * `GdkPixbuf` contains information about an image's pixel data,
899
+ * its color space, bits per sample, width and height, and the
900
+ * rowstride (the number of bytes between the start of one row
901
+ * and the start of the next).
902
+ *
903
+ * ## Creating new `GdkPixbuf`
904
+ *
905
+ * The most basic way to create a pixbuf is to wrap an existing pixel
906
+ * buffer with a [class`GdkPixbuf`.Pixbuf] instance. You can use the
907
+ * [`ctor`GdkPixbuf`.Pixbuf.new_from_data`] function to do this.
908
+ *
909
+ * Every time you create a new `GdkPixbuf` instance for some data, you
910
+ * will need to specify the destroy notification function that will be
911
+ * called when the data buffer needs to be freed; this will happen when
912
+ * a `GdkPixbuf` is finalized by the reference counting functions. If
913
+ * you have a chunk of static data compiled into your application, you
914
+ * can pass in `NULL` as the destroy notification function so that the
915
+ * data will not be freed.
916
+ *
917
+ * The [`ctor`GdkPixbuf`.Pixbuf.new`] constructor function can be used
918
+ * as a convenience to create a pixbuf with an empty buffer; this is
919
+ * equivalent to allocating a data buffer using `malloc()` and then
920
+ * wrapping it with `gdk_pixbuf_new_from_data()`. The `gdk_pixbuf_new()`
921
+ * function will compute an optimal rowstride so that rendering can be
922
+ * performed with an efficient algorithm.
923
+ *
924
+ * As a special case, you can use the [`ctor`GdkPixbuf`.Pixbuf.new_from_xpm_data`]
925
+ * function to create a pixbuf from inline XPM image data.
926
+ *
927
+ * You can also copy an existing pixbuf with the [method`Pixbuf`.copy]
928
+ * function. This is not the same as just acquiring a reference to
929
+ * the old pixbuf instance: the copy function will actually duplicate
930
+ * the pixel data in memory and create a new [class`Pixbuf]` instance
931
+ * for it.
932
+ *
933
+ * ## Reference counting
934
+ *
935
+ * `GdkPixbuf` structures are reference counted. This means that an
936
+ * application can share a single pixbuf among many parts of the
937
+ * code. When a piece of the program needs to use a pixbuf, it should
938
+ * acquire a reference to it by calling `g_object_ref()`; when it no
939
+ * longer needs the pixbuf, it should release the reference it acquired
940
+ * by calling `g_object_unref()`. The resources associated with a
941
+ * `GdkPixbuf` will be freed when its reference count drops to zero.
942
+ * Newly-created `GdkPixbuf` instances start with a reference count
943
+ * of one.
944
+ *
945
+ * ## Image Data
946
+ *
947
+ * Image data in a pixbuf is stored in memory in an uncompressed,
948
+ * packed format. Rows in the image are stored top to bottom, and
949
+ * in each row pixels are stored from left to right.
950
+ *
951
+ * There may be padding at the end of a row.
952
+ *
953
+ * The "rowstride" value of a pixbuf, as returned by [`method`GdkPixbuf`.Pixbuf.get_rowstride`],
954
+ * indicates the number of bytes between rows.
955
+ *
956
+ * **NOTE**: If you are copying raw pixbuf data with `memcpy()` note that the
957
+ * last row in the pixbuf may not be as wide as the full rowstride, but rather
958
+ * just as wide as the pixel data needs to be; that is: it is unsafe to do
959
+ * `memcpy (dest, pixels, rowstride * height)` to copy a whole pixbuf. Use
960
+ * [method`GdkPixbuf`.Pixbuf.copy] instead, or compute the width in bytes of the
961
+ * last row as:
962
+ *
963
+ * ```c
964
+ * last_row = width * ((n_channels * bits_per_sample + 7) / 8);
965
+ * ```
966
+ *
967
+ * The same rule applies when iterating over each row of a `GdkPixbuf` pixels
968
+ * array.
969
+ *
970
+ * The following code illustrates a simple `put_pixel()`
971
+ * function for RGB pixbufs with 8 bits per channel with an alpha
972
+ * channel.
973
+ *
974
+ * ```c
975
+ * static void
976
+ * put_pixel (GdkPixbuf *pixbuf,
977
+ * int x,
978
+ * int y,
979
+ * guchar red,
980
+ * guchar green,
981
+ * guchar blue,
982
+ * guchar alpha)
983
+ * {
984
+ * int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
985
+ *
986
+ * // Ensure that the pixbuf is valid
987
+ * g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
988
+ * g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
989
+ * g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
990
+ * g_assert (n_channels == 4);
991
+ *
992
+ * int width = gdk_pixbuf_get_width (pixbuf);
993
+ * int height = gdk_pixbuf_get_height (pixbuf);
994
+ *
995
+ * // Ensure that the coordinates are in a valid range
996
+ * g_assert (x >= 0 && x < width);
997
+ * g_assert (y >= 0 && y < height);
998
+ *
999
+ * int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
1000
+ *
1001
+ * // The pixel buffer in the GdkPixbuf instance
1002
+ * guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);
1003
+ *
1004
+ * // The pixel we wish to modify
1005
+ * guchar *p = pixels + y * rowstride + x * n_channels;
1006
+ * p[0] = red;
1007
+ * p[1] = green;
1008
+ * p[2] = blue;
1009
+ * p[3] = alpha;
1010
+ * }
1011
+ * ```
1012
+ *
1013
+ * ## Loading images
1014
+ *
1015
+ * The `GdkPixBuf` class provides a simple mechanism for loading
1016
+ * an image from a file in synchronous and asynchronous fashion.
1017
+ *
1018
+ * For GUI applications, it is recommended to use the asynchronous
1019
+ * stream API to avoid blocking the control flow of the application.
1020
+ *
1021
+ * Additionally, `GdkPixbuf` provides the [class`GdkPixbuf`.PixbufLoader`]
1022
+ * API for progressive image loading.
1023
+ *
1024
+ * ## Saving images
1025
+ *
1026
+ * The `GdkPixbuf` class provides methods for saving image data in
1027
+ * a number of file formats. The formatted data can be written to a
1028
+ * file or to a memory buffer. `GdkPixbuf` can also call a user-defined
1029
+ * callback on the data, which allows to e.g. write the image
1030
+ * to a socket or store it in a database.
1031
+ * @class
1032
+ */
1033
+ class Pixbuf extends GObject.Object {
1034
+
1035
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
1036
+
1037
+ static name: string
1038
+ static $gtype: GObject.GType<Pixbuf>
1039
+
1040
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.Pixbuf
1041
+
1042
+ constructor(config?: Pixbuf.ConstructorProperties)
1043
+ /**
1044
+ * Creates a new `GdkPixbuf` structure and allocates a buffer for it.
1045
+ *
1046
+ * If the allocation of the buffer failed, this function will return `NULL`.
1047
+ *
1048
+ * The buffer has an optimal rowstride. Note that the buffer is not cleared;
1049
+ * you will have to fill it completely yourself.
1050
+ * @constructor
1051
+ * @param colorspace Color space for image
1052
+ * @param has_alpha Whether the image should have transparency information
1053
+ * @param bits_per_sample Number of bits per color sample
1054
+ * @param width Width of image in pixels, must be > 0
1055
+ * @param height Height of image in pixels, must be > 0
1056
+ * @returns A newly-created pixel buffer
1057
+ */
1058
+ constructor(colorspace: Colorspace, has_alpha: boolean, bits_per_sample: number, width: number, height: number)
1059
+ /**
1060
+ * Creates a new `GdkPixbuf` structure and allocates a buffer for it.
1061
+ *
1062
+ * If the allocation of the buffer failed, this function will return `NULL`.
1063
+ *
1064
+ * The buffer has an optimal rowstride. Note that the buffer is not cleared;
1065
+ * you will have to fill it completely yourself.
1066
+ * @constructor
1067
+ * @param colorspace Color space for image
1068
+ * @param has_alpha Whether the image should have transparency information
1069
+ * @param bits_per_sample Number of bits per color sample
1070
+ * @param width Width of image in pixels, must be > 0
1071
+ * @param height Height of image in pixels, must be > 0
1072
+ * @returns A newly-created pixel buffer
1073
+ */
1074
+ static new(colorspace: Colorspace, has_alpha: boolean, bits_per_sample: number, width: number, height: number): Pixbuf
1075
+ /**
1076
+ * Creates a new #GdkPixbuf out of in-memory readonly image data.
1077
+ *
1078
+ * Currently only RGB images with 8 bits per sample are supported.
1079
+ *
1080
+ * This is the `GBytes` variant of gdk_pixbuf_new_from_data(), useful
1081
+ * for language bindings.
1082
+ * @constructor
1083
+ * @param data Image data in 8-bit/sample packed format inside a #GBytes
1084
+ * @param colorspace Colorspace for the image data
1085
+ * @param has_alpha Whether the data has an opacity channel
1086
+ * @param bits_per_sample Number of bits per sample
1087
+ * @param width Width of the image in pixels, must be > 0
1088
+ * @param height Height of the image in pixels, must be > 0
1089
+ * @param rowstride Distance in bytes between row starts
1090
+ * @returns A newly-created pixbuf
1091
+ */
1092
+ static new_from_bytes(data: GLib.Bytes, colorspace: Colorspace, has_alpha: boolean, bits_per_sample: number, width: number, height: number, rowstride: number): Pixbuf
1093
+ /**
1094
+ * Creates a new #GdkPixbuf out of in-memory image data.
1095
+ *
1096
+ * Currently only RGB images with 8 bits per sample are supported.
1097
+ *
1098
+ * Since you are providing a pre-allocated pixel buffer, you must also
1099
+ * specify a way to free that data. This is done with a function of
1100
+ * type `GdkPixbufDestroyNotify`. When a pixbuf created with is
1101
+ * finalized, your destroy notification function will be called, and
1102
+ * it is its responsibility to free the pixel array.
1103
+ *
1104
+ * See also: [ctor`GdkPixbuf`.Pixbuf.new_from_bytes]
1105
+ * @constructor
1106
+ * @param data Image data in 8-bit/sample packed format
1107
+ * @param colorspace Colorspace for the image data
1108
+ * @param has_alpha Whether the data has an opacity channel
1109
+ * @param bits_per_sample Number of bits per sample
1110
+ * @param width Width of the image in pixels, must be > 0
1111
+ * @param height Height of the image in pixels, must be > 0
1112
+ * @param rowstride Distance in bytes between row starts
1113
+ * @param destroy_fn Function used to free the data when the pixbuf's reference count drops to zero, or %NULL if the data should not be freed
1114
+ * @returns A newly-created pixbuf
1115
+ */
1116
+ static new_from_data(data: Uint8Array, colorspace: Colorspace, has_alpha: boolean, bits_per_sample: number, width: number, height: number, rowstride: number, destroy_fn: PixbufDestroyNotify | null): Pixbuf
1117
+ /**
1118
+ * Creates a new pixbuf by loading an image from a file.
1119
+ *
1120
+ * The file format is detected automatically.
1121
+ *
1122
+ * If `NULL` is returned, then `error` will be set. Possible errors are:
1123
+ *
1124
+ * - the file could not be opened
1125
+ * - there is no loader for the file's format
1126
+ * - there is not enough memory to allocate the image buffer
1127
+ * - the image buffer contains invalid data
1128
+ *
1129
+ * The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
1130
+ * @constructor
1131
+ * @param filename Name of file to load, in the GLib file name encoding
1132
+ * @returns A newly-created pixbuf
1133
+ */
1134
+ static new_from_file(filename: string): Pixbuf
1135
+ /**
1136
+ * Creates a new pixbuf by loading an image from a file.
1137
+ *
1138
+ * The file format is detected automatically.
1139
+ *
1140
+ * If `NULL` is returned, then `error` will be set. Possible errors are:
1141
+ *
1142
+ * - the file could not be opened
1143
+ * - there is no loader for the file's format
1144
+ * - there is not enough memory to allocate the image buffer
1145
+ * - the image buffer contains invalid data
1146
+ *
1147
+ * The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
1148
+ *
1149
+ * The image will be scaled to fit in the requested size, optionally preserving
1150
+ * the image's aspect ratio.
1151
+ *
1152
+ * When preserving the aspect ratio, a `width` of -1 will cause the image
1153
+ * to be scaled to the exact given height, and a `height` of -1 will cause
1154
+ * the image to be scaled to the exact given width. When not preserving
1155
+ * aspect ratio, a `width` or `height` of -1 means to not scale the image
1156
+ * at all in that dimension. Negative values for `width` and `height` are
1157
+ * allowed since 2.8.
1158
+ * @constructor
1159
+ * @param filename Name of file to load, in the GLib file name encoding
1160
+ * @param width The width the image should have or -1 to not constrain the width
1161
+ * @param height The height the image should have or -1 to not constrain the height
1162
+ * @param preserve_aspect_ratio `TRUE` to preserve the image's aspect ratio
1163
+ * @returns A newly-created pixbuf
1164
+ */
1165
+ static new_from_file_at_scale(filename: string, width: number, height: number, preserve_aspect_ratio: boolean): Pixbuf
1166
+ /**
1167
+ * Creates a new pixbuf by loading an image from a file.
1168
+ *
1169
+ * The file format is detected automatically.
1170
+ *
1171
+ * If `NULL` is returned, then `error` will be set. Possible errors are:
1172
+ *
1173
+ * - the file could not be opened
1174
+ * - there is no loader for the file's format
1175
+ * - there is not enough memory to allocate the image buffer
1176
+ * - the image buffer contains invalid data
1177
+ *
1178
+ * The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
1179
+ *
1180
+ * The image will be scaled to fit in the requested size, preserving
1181
+ * the image's aspect ratio. Note that the returned pixbuf may be smaller
1182
+ * than `width` x `height`, if the aspect ratio requires it. To load
1183
+ * and image at the requested size, regardless of aspect ratio, use
1184
+ * [ctor`GdkPixbuf`.Pixbuf.new_from_file_at_scale].
1185
+ * @constructor
1186
+ * @param filename Name of file to load, in the GLib file name encoding
1187
+ * @param width The width the image should have or -1 to not constrain the width
1188
+ * @param height The height the image should have or -1 to not constrain the height
1189
+ * @returns A newly-created pixbuf
1190
+ */
1191
+ static new_from_file_at_size(filename: string, width: number, height: number): Pixbuf
1192
+ /**
1193
+ * Creates a `GdkPixbuf` from a flat representation that is suitable for
1194
+ * storing as inline data in a program.
1195
+ *
1196
+ * This is useful if you want to ship a program with images, but don't want
1197
+ * to depend on any external files.
1198
+ *
1199
+ * GdkPixbuf ships with a program called `gdk-pixbuf-csource`, which allows
1200
+ * for conversion of `GdkPixbuf`s into such a inline representation.
1201
+ *
1202
+ * In almost all cases, you should pass the `--raw` option to
1203
+ * `gdk-pixbuf-csource`. A sample invocation would be:
1204
+ *
1205
+ * ```
1206
+ * gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
1207
+ * ```
1208
+ *
1209
+ * For the typical case where the inline pixbuf is read-only static data,
1210
+ * you don't need to copy the pixel data unless you intend to write to
1211
+ * it, so you can pass `FALSE` for `copy_pixels`. If you pass `--rle` to
1212
+ * `gdk-pixbuf-csource`, a copy will be made even if `copy_pixels` is `FALSE`,
1213
+ * so using this option is generally a bad idea.
1214
+ *
1215
+ * If you create a pixbuf from const inline data compiled into your
1216
+ * program, it's probably safe to ignore errors and disable length checks,
1217
+ * since things will always succeed:
1218
+ *
1219
+ * ```c
1220
+ * pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
1221
+ * ```
1222
+ *
1223
+ * For non-const inline data, you could get out of memory. For untrusted
1224
+ * inline data located at runtime, you could have corrupt inline data in
1225
+ * addition.
1226
+ * @constructor
1227
+ * @param data Byte data containing a serialized `GdkPixdata` structure
1228
+ * @param copy_pixels Whether to copy the pixel data, or use direct pointers `data` for the resulting pixbuf
1229
+ * @returns A newly-created pixbuf
1230
+ */
1231
+ static new_from_inline(data: Uint8Array, copy_pixels: boolean): Pixbuf
1232
+ /**
1233
+ * Creates a new pixbuf by loading an image from an resource.
1234
+ *
1235
+ * The file format is detected automatically. If `NULL` is returned, then
1236
+ * `error` will be set.
1237
+ * @constructor
1238
+ * @param resource_path the path of the resource file
1239
+ * @returns A newly-created pixbuf
1240
+ */
1241
+ static new_from_resource(resource_path: string | null): Pixbuf
1242
+ /**
1243
+ * Creates a new pixbuf by loading an image from an resource.
1244
+ *
1245
+ * The file format is detected automatically. If `NULL` is returned, then
1246
+ * `error` will be set.
1247
+ *
1248
+ * The image will be scaled to fit in the requested size, optionally
1249
+ * preserving the image's aspect ratio. When preserving the aspect ratio,
1250
+ * a `width` of -1 will cause the image to be scaled to the exact given
1251
+ * height, and a `height` of -1 will cause the image to be scaled to the
1252
+ * exact given width. When not preserving aspect ratio, a `width` or
1253
+ * `height` of -1 means to not scale the image at all in that dimension.
1254
+ *
1255
+ * The stream is not closed.
1256
+ * @constructor
1257
+ * @param resource_path the path of the resource file
1258
+ * @param width The width the image should have or -1 to not constrain the width
1259
+ * @param height The height the image should have or -1 to not constrain the height
1260
+ * @param preserve_aspect_ratio `TRUE` to preserve the image's aspect ratio
1261
+ * @returns A newly-created pixbuf
1262
+ */
1263
+ static new_from_resource_at_scale(resource_path: string | null, width: number, height: number, preserve_aspect_ratio: boolean): Pixbuf
1264
+ /**
1265
+ * Creates a new pixbuf by loading an image from an input stream.
1266
+ *
1267
+ * The file format is detected automatically.
1268
+ *
1269
+ * If `NULL` is returned, then `error` will be set.
1270
+ *
1271
+ * The `cancellable` can be used to abort the operation from another thread.
1272
+ * If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be
1273
+ * returned. Other possible errors are in the `GDK_PIXBUF_ERROR` and
1274
+ * `G_IO_ERROR` domains.
1275
+ *
1276
+ * The stream is not closed.
1277
+ * @constructor
1278
+ * @param stream a `GInputStream` to load the pixbuf from
1279
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
1280
+ * @returns A newly-created pixbuf
1281
+ */
1282
+ static new_from_stream(stream: Gio.InputStream, cancellable: Gio.Cancellable | null): Pixbuf
1283
+ /**
1284
+ * Creates a new pixbuf by loading an image from an input stream.
1285
+ *
1286
+ * The file format is detected automatically. If `NULL` is returned, then
1287
+ * `error` will be set. The `cancellable` can be used to abort the operation
1288
+ * from another thread. If the operation was cancelled, the error
1289
+ * `G_IO_ERROR_CANCELLED` will be returned. Other possible errors are in
1290
+ * the `GDK_PIXBUF_ERROR` and `G_IO_ERROR` domains.
1291
+ *
1292
+ * The image will be scaled to fit in the requested size, optionally
1293
+ * preserving the image's aspect ratio.
1294
+ *
1295
+ * When preserving the aspect ratio, a `width` of -1 will cause the image to be
1296
+ * scaled to the exact given height, and a `height` of -1 will cause the image
1297
+ * to be scaled to the exact given width. If both `width` and `height` are
1298
+ * given, this function will behave as if the smaller of the two values
1299
+ * is passed as -1.
1300
+ *
1301
+ * When not preserving aspect ratio, a `width` or `height` of -1 means to not
1302
+ * scale the image at all in that dimension.
1303
+ *
1304
+ * The stream is not closed.
1305
+ * @constructor
1306
+ * @param stream a `GInputStream` to load the pixbuf from
1307
+ * @param width The width the image should have or -1 to not constrain the width
1308
+ * @param height The height the image should have or -1 to not constrain the height
1309
+ * @param preserve_aspect_ratio `TRUE` to preserve the image's aspect ratio
1310
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
1311
+ * @returns A newly-created pixbuf
1312
+ */
1313
+ static new_from_stream_at_scale(stream: Gio.InputStream, width: number, height: number, preserve_aspect_ratio: boolean, cancellable: Gio.Cancellable | null): Pixbuf
1314
+ /**
1315
+ * Finishes an asynchronous pixbuf creation operation started with
1316
+ * gdk_pixbuf_new_from_stream_async().
1317
+ * @constructor
1318
+ * @param async_result a `GAsyncResult`
1319
+ * @returns the newly created pixbuf
1320
+ */
1321
+ static new_from_stream_finish(async_result: Gio.AsyncResult): Pixbuf
1322
+ /**
1323
+ * Creates a new pixbuf by parsing XPM data in memory.
1324
+ *
1325
+ * This data is commonly the result of including an XPM file into a
1326
+ * program's C source.
1327
+ * @constructor
1328
+ * @param data Pointer to inline XPM data.
1329
+ * @returns A newly-created pixbuf
1330
+ */
1331
+ static new_from_xpm_data(data: string[]): Pixbuf
1332
+ _init(config?: Pixbuf.ConstructorProperties): void
1333
+ /**
1334
+ * Creates a new pixbuf by asynchronously loading an image from an input stream.
1335
+ *
1336
+ * For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
1337
+ * version of this function.
1338
+ *
1339
+ * When the operation is finished, `callback` will be called in the main thread.
1340
+ * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of
1341
+ * the operation.
1342
+ * @param stream a `GInputStream` from which to load the pixbuf
1343
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
1344
+ * @param callback a `GAsyncReadyCallback` to call when the pixbuf is loaded
1345
+ */
1346
+ static new_from_stream_async(stream: Gio.InputStream, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Pixbuf> | null): void
1347
+ /**
1348
+ * Creates a new pixbuf by asynchronously loading an image from an input stream.
1349
+ *
1350
+ * For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the synchronous
1351
+ * version of this function.
1352
+ *
1353
+ * When the operation is finished, `callback` will be called in the main thread.
1354
+ * You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
1355
+ * @param stream a `GInputStream` from which to load the pixbuf
1356
+ * @param width the width the image should have or -1 to not constrain the width
1357
+ * @param height the height the image should have or -1 to not constrain the height
1358
+ * @param preserve_aspect_ratio `TRUE` to preserve the image's aspect ratio
1359
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
1360
+ * @param callback a `GAsyncReadyCallback` to call when the pixbuf is loaded
1361
+ */
1362
+ static new_from_stream_at_scale_async(stream: Gio.InputStream, width: number, height: number, preserve_aspect_ratio: boolean, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Pixbuf> | null): void
1363
+ /**
1364
+ * Calculates the rowstride that an image created with those values would
1365
+ * have.
1366
+ *
1367
+ * This function is useful for front-ends and backends that want to check
1368
+ * image values without needing to create a `GdkPixbuf`.
1369
+ * @param colorspace Color space for image
1370
+ * @param has_alpha Whether the image should have transparency information
1371
+ * @param bits_per_sample Number of bits per color sample
1372
+ * @param width Width of image in pixels, must be > 0
1373
+ * @param height Height of image in pixels, must be > 0
1374
+ * @returns the rowstride for the given values, or -1 in case of error.
1375
+ */
1376
+ static calculate_rowstride(colorspace: Colorspace, has_alpha: boolean, bits_per_sample: number, width: number, height: number): number
1377
+ /**
1378
+ * Parses an image file far enough to determine its format and size.
1379
+ * @param filename The name of the file to identify.
1380
+ * @returns A `GdkPixbufFormat` describing the image format of the file
1381
+ */
1382
+ static get_file_info(filename: string): [ /* returnType */ PixbufFormat | null, /* width */ number, /* height */ number ]
1383
+ /**
1384
+ * Asynchronously parses an image file far enough to determine its
1385
+ * format and size.
1386
+ *
1387
+ * For more details see gdk_pixbuf_get_file_info(), which is the synchronous
1388
+ * version of this function.
1389
+ *
1390
+ * When the operation is finished, `callback` will be called in the
1391
+ * main thread. You can then call gdk_pixbuf_get_file_info_finish() to
1392
+ * get the result of the operation.
1393
+ * @param filename The name of the file to identify
1394
+ * @param cancellable optional `GCancellable` object, `NULL` to ignore
1395
+ * @param callback a `GAsyncReadyCallback` to call when the file info is available
1396
+ */
1397
+ static get_file_info_async(filename: string, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<Pixbuf> | null): void
1398
+ /**
1399
+ * Finishes an asynchronous pixbuf parsing operation started with
1400
+ * gdk_pixbuf_get_file_info_async().
1401
+ * @param async_result a `GAsyncResult`
1402
+ * @returns A `GdkPixbufFormat` describing the image format of the file
1403
+ */
1404
+ static get_file_info_finish(async_result: Gio.AsyncResult): [ /* returnType */ PixbufFormat | null, /* width */ number, /* height */ number ]
1405
+ /**
1406
+ * Obtains the available information about the image formats supported
1407
+ * by GdkPixbuf.
1408
+ * @returns A list of support image formats.
1409
+ */
1410
+ static get_formats(): PixbufFormat[]
1411
+ /**
1412
+ * Initalizes the gdk-pixbuf loader modules referenced by the `loaders.cache`
1413
+ * file present inside that directory.
1414
+ *
1415
+ * This is to be used by applications that want to ship certain loaders
1416
+ * in a different location from the system ones.
1417
+ *
1418
+ * This is needed when the OS or runtime ships a minimal number of loaders
1419
+ * so as to reduce the potential attack surface of carefully crafted image
1420
+ * files, especially for uncommon file types. Applications that require
1421
+ * broader image file types coverage, such as image viewers, would be
1422
+ * expected to ship the gdk-pixbuf modules in a separate location, bundled
1423
+ * with the application in a separate directory from the OS or runtime-
1424
+ * provided modules.
1425
+ * @param path Path to directory where the `loaders.cache` is installed
1426
+ */
1427
+ static init_modules(path: string | null): boolean
1428
+ /**
1429
+ * Finishes an asynchronous pixbuf save operation started with
1430
+ * gdk_pixbuf_save_to_stream_async().
1431
+ * @param async_result a `GAsyncResult`
1432
+ * @returns `TRUE` if the pixbuf was saved successfully, `FALSE` if an error was set.
1433
+ */
1434
+ static save_to_stream_finish(async_result: Gio.AsyncResult): boolean
1435
+ }
1436
+
1437
+ module PixbufAnimation {
1438
+
1439
+ // Constructor properties interface
1440
+
1441
+ interface ConstructorProperties extends GObject.Object.ConstructorProperties {
1442
+ }
1443
+
1444
+ }
1445
+
1446
+ interface PixbufAnimation {
1447
+
1448
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1449
+
1450
+ parent_instance: GObject.Object
1451
+
1452
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1453
+
1454
+ /**
1455
+ * Queries the height of the bounding box of a pixbuf animation.
1456
+ * @returns Height of the bounding box of the animation.
1457
+ */
1458
+ get_height(): number
1459
+ /**
1460
+ * Get an iterator for displaying an animation.
1461
+ *
1462
+ * The iterator provides the frames that should be displayed at a
1463
+ * given time.
1464
+ *
1465
+ * `start_time` would normally come from g_get_current_time(), and marks
1466
+ * the beginning of animation playback. After creating an iterator, you
1467
+ * should immediately display the pixbuf returned by
1468
+ * gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install
1469
+ * a timeout (with g_timeout_add()) or by some other mechanism ensure
1470
+ * that you'll update the image after
1471
+ * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
1472
+ * the image is updated, you should reinstall the timeout with the new,
1473
+ * possibly-changed delay time.
1474
+ *
1475
+ * As a shortcut, if `start_time` is `NULL`, the result of
1476
+ * g_get_current_time() will be used automatically.
1477
+ *
1478
+ * To update the image (i.e. possibly change the result of
1479
+ * gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
1480
+ * call gdk_pixbuf_animation_iter_advance().
1481
+ *
1482
+ * If you're using #GdkPixbufLoader, in addition to updating the image
1483
+ * after the delay time, you should also update it whenever you
1484
+ * receive the area_updated signal and
1485
+ * gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
1486
+ * `TRUE`. In this case, the frame currently being fed into the loader
1487
+ * has received new data, so needs to be refreshed. The delay time for
1488
+ * a frame may also be modified after an area_updated signal, for
1489
+ * example if the delay time for a frame is encoded in the data after
1490
+ * the frame itself. So your timeout should be reinstalled after any
1491
+ * area_updated signal.
1492
+ *
1493
+ * A delay time of -1 is possible, indicating "infinite".
1494
+ * @param start_time time when the animation starts playing
1495
+ * @returns an iterator to move over the animation
1496
+ */
1497
+ get_iter(start_time: GLib.TimeVal | null): PixbufAnimationIter
1498
+ /**
1499
+ * Retrieves a static image for the animation.
1500
+ *
1501
+ * If an animation is really just a plain image (has only one frame),
1502
+ * this function returns that image.
1503
+ *
1504
+ * If the animation is an animation, this function returns a reasonable
1505
+ * image to use as a static unanimated image, which might be the first
1506
+ * frame, or something more sophisticated depending on the file format.
1507
+ *
1508
+ * If an animation hasn't loaded any frames yet, this function will
1509
+ * return `NULL`.
1510
+ * @returns unanimated image representing the animation
1511
+ */
1512
+ get_static_image(): Pixbuf
1513
+ /**
1514
+ * Queries the width of the bounding box of a pixbuf animation.
1515
+ * @returns Width of the bounding box of the animation.
1516
+ */
1517
+ get_width(): number
1518
+ /**
1519
+ * Checks whether the animation is a static image.
1520
+ *
1521
+ * If you load a file with gdk_pixbuf_animation_new_from_file() and it
1522
+ * turns out to be a plain, unanimated image, then this function will
1523
+ * return `TRUE`. Use gdk_pixbuf_animation_get_static_image() to retrieve
1524
+ * the image.
1525
+ * @returns `TRUE` if the "animation" was really just an image
1526
+ */
1527
+ is_static_image(): boolean
1528
+
1529
+ // Own virtual methods of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1530
+
1531
+ /**
1532
+ * Get an iterator for displaying an animation.
1533
+ *
1534
+ * The iterator provides the frames that should be displayed at a
1535
+ * given time.
1536
+ *
1537
+ * `start_time` would normally come from g_get_current_time(), and marks
1538
+ * the beginning of animation playback. After creating an iterator, you
1539
+ * should immediately display the pixbuf returned by
1540
+ * gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install
1541
+ * a timeout (with g_timeout_add()) or by some other mechanism ensure
1542
+ * that you'll update the image after
1543
+ * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
1544
+ * the image is updated, you should reinstall the timeout with the new,
1545
+ * possibly-changed delay time.
1546
+ *
1547
+ * As a shortcut, if `start_time` is `NULL`, the result of
1548
+ * g_get_current_time() will be used automatically.
1549
+ *
1550
+ * To update the image (i.e. possibly change the result of
1551
+ * gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
1552
+ * call gdk_pixbuf_animation_iter_advance().
1553
+ *
1554
+ * If you're using #GdkPixbufLoader, in addition to updating the image
1555
+ * after the delay time, you should also update it whenever you
1556
+ * receive the area_updated signal and
1557
+ * gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
1558
+ * `TRUE`. In this case, the frame currently being fed into the loader
1559
+ * has received new data, so needs to be refreshed. The delay time for
1560
+ * a frame may also be modified after an area_updated signal, for
1561
+ * example if the delay time for a frame is encoded in the data after
1562
+ * the frame itself. So your timeout should be reinstalled after any
1563
+ * area_updated signal.
1564
+ *
1565
+ * A delay time of -1 is possible, indicating "infinite".
1566
+ * @virtual
1567
+ * @param start_time time when the animation starts playing
1568
+ * @returns an iterator to move over the animation
1569
+ */
1570
+ vfunc_get_iter(start_time: GLib.TimeVal | null): PixbufAnimationIter
1571
+ vfunc_get_size(width: number, height: number): void
1572
+ /**
1573
+ * Retrieves a static image for the animation.
1574
+ *
1575
+ * If an animation is really just a plain image (has only one frame),
1576
+ * this function returns that image.
1577
+ *
1578
+ * If the animation is an animation, this function returns a reasonable
1579
+ * image to use as a static unanimated image, which might be the first
1580
+ * frame, or something more sophisticated depending on the file format.
1581
+ *
1582
+ * If an animation hasn't loaded any frames yet, this function will
1583
+ * return `NULL`.
1584
+ * @virtual
1585
+ * @returns unanimated image representing the animation
1586
+ */
1587
+ vfunc_get_static_image(): Pixbuf
1588
+ /**
1589
+ * Checks whether the animation is a static image.
1590
+ *
1591
+ * If you load a file with gdk_pixbuf_animation_new_from_file() and it
1592
+ * turns out to be a plain, unanimated image, then this function will
1593
+ * return `TRUE`. Use gdk_pixbuf_animation_get_static_image() to retrieve
1594
+ * the image.
1595
+ * @virtual
1596
+ * @returns `TRUE` if the "animation" was really just an image
1597
+ */
1598
+ vfunc_is_static_image(): boolean
1599
+
1600
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1601
+
1602
+ connect(sigName: string, callback: (...args: any[]) => void): number
1603
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1604
+ emit(sigName: string, ...args: any[]): void
1605
+ disconnect(id: number): void
1606
+ }
1607
+
1608
+ /**
1609
+ * An opaque object representing an animation.
1610
+ *
1611
+ * The GdkPixBuf library provides a simple mechanism to load and
1612
+ * represent animations. An animation is conceptually a series of
1613
+ * frames to be displayed over time.
1614
+ *
1615
+ * The animation may not be represented as a series of frames
1616
+ * internally; for example, it may be stored as a sprite and
1617
+ * instructions for moving the sprite around a background.
1618
+ *
1619
+ * To display an animation you don't need to understand its
1620
+ * representation, however; you just ask `GdkPixbuf` what should
1621
+ * be displayed at a given point in time.
1622
+ * @class
1623
+ */
1624
+ class PixbufAnimation extends GObject.Object {
1625
+
1626
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1627
+
1628
+ static name: string
1629
+ static $gtype: GObject.GType<PixbufAnimation>
1630
+
1631
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimation
1632
+
1633
+ constructor(config?: PixbufAnimation.ConstructorProperties)
1634
+ /**
1635
+ * Creates a new animation by loading it from a file.
1636
+ *
1637
+ * The file format is detected automatically.
1638
+ *
1639
+ * If the file's format does not support multi-frame images, then an animation
1640
+ * with a single frame will be created.
1641
+ *
1642
+ * Possible errors are in the `GDK_PIXBUF_ERROR` and `G_FILE_ERROR` domains.
1643
+ * @constructor
1644
+ * @param filename Name of file to load, in the GLib file name encoding
1645
+ * @returns A newly-created animation
1646
+ */
1647
+ static new_from_file(filename: string): PixbufAnimation
1648
+ /**
1649
+ * Creates a new pixbuf animation by loading an image from an resource.
1650
+ *
1651
+ * The file format is detected automatically. If `NULL` is returned, then
1652
+ * `error` will be set.
1653
+ * @constructor
1654
+ * @param resource_path the path of the resource file
1655
+ * @returns A newly-created animation
1656
+ */
1657
+ static new_from_resource(resource_path: string | null): PixbufAnimation
1658
+ /**
1659
+ * Creates a new animation by loading it from an input stream.
1660
+ *
1661
+ * The file format is detected automatically.
1662
+ *
1663
+ * If `NULL` is returned, then `error` will be set.
1664
+ *
1665
+ * The `cancellable` can be used to abort the operation from another thread.
1666
+ * If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be
1667
+ * returned. Other possible errors are in the `GDK_PIXBUF_ERROR` and
1668
+ * `G_IO_ERROR` domains.
1669
+ *
1670
+ * The stream is not closed.
1671
+ * @constructor
1672
+ * @param stream a `GInputStream` to load the pixbuf from
1673
+ * @param cancellable optional `GCancellable` object
1674
+ * @returns A newly-created animation
1675
+ */
1676
+ static new_from_stream(stream: Gio.InputStream, cancellable: Gio.Cancellable | null): PixbufAnimation
1677
+ /**
1678
+ * Finishes an asynchronous pixbuf animation creation operation started with
1679
+ * [func`GdkPixbuf`.PixbufAnimation.new_from_stream_async].
1680
+ * @constructor
1681
+ * @param async_result a #GAsyncResult
1682
+ * @returns the newly created animation
1683
+ */
1684
+ static new_from_stream_finish(async_result: Gio.AsyncResult): PixbufAnimation
1685
+ _init(config?: PixbufAnimation.ConstructorProperties): void
1686
+ /**
1687
+ * Creates a new animation by asynchronously loading an image from an input stream.
1688
+ *
1689
+ * For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
1690
+ * version of this function.
1691
+ *
1692
+ * When the operation is finished, `callback` will be called in the main thread.
1693
+ * You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the
1694
+ * result of the operation.
1695
+ * @param stream a #GInputStream from which to load the animation
1696
+ * @param cancellable optional #GCancellable object
1697
+ * @param callback a `GAsyncReadyCallback` to call when the pixbuf is loaded
1698
+ */
1699
+ static new_from_stream_async(stream: Gio.InputStream, cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<PixbufAnimation> | null): void
1700
+ }
1701
+
1702
+ module PixbufAnimationIter {
1703
+
1704
+ // Constructor properties interface
1705
+
1706
+ interface ConstructorProperties extends GObject.Object.ConstructorProperties {
1707
+ }
1708
+
1709
+ }
1710
+
1711
+ interface PixbufAnimationIter {
1712
+
1713
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1714
+
1715
+ parent_instance: GObject.Object
1716
+
1717
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1718
+
1719
+ /**
1720
+ * Possibly advances an animation to a new frame.
1721
+ *
1722
+ * Chooses the frame based on the start time passed to
1723
+ * gdk_pixbuf_animation_get_iter().
1724
+ *
1725
+ * `current_time` would normally come from g_get_current_time(), and
1726
+ * must be greater than or equal to the time passed to
1727
+ * gdk_pixbuf_animation_get_iter(), and must increase or remain
1728
+ * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
1729
+ * called. That is, you can't go backward in time; animations only
1730
+ * play forward.
1731
+ *
1732
+ * As a shortcut, pass `NULL` for the current time and g_get_current_time()
1733
+ * will be invoked on your behalf. So you only need to explicitly pass
1734
+ * `current_time` if you're doing something odd like playing the animation
1735
+ * at double speed.
1736
+ *
1737
+ * If this function returns `FALSE`, there's no need to update the animation
1738
+ * display, assuming the display had been rendered prior to advancing;
1739
+ * if `TRUE`, you need to call gdk_pixbuf_animation_iter_get_pixbuf()
1740
+ * and update the display with the new pixbuf.
1741
+ * @param current_time current time
1742
+ * @returns `TRUE` if the image may need updating
1743
+ */
1744
+ advance(current_time: GLib.TimeVal | null): boolean
1745
+ /**
1746
+ * Gets the number of milliseconds the current pixbuf should be displayed,
1747
+ * or -1 if the current pixbuf should be displayed forever.
1748
+ *
1749
+ * The `g_timeout_add()` function conveniently takes a timeout in milliseconds,
1750
+ * so you can use a timeout to schedule the next update.
1751
+ *
1752
+ * Note that some formats, like GIF, might clamp the timeout values in the
1753
+ * image file to avoid updates that are just too quick. The minimum timeout
1754
+ * for GIF images is currently 20 milliseconds.
1755
+ * @returns delay time in milliseconds (thousandths of a second)
1756
+ */
1757
+ get_delay_time(): number
1758
+ /**
1759
+ * Gets the current pixbuf which should be displayed.
1760
+ *
1761
+ * The pixbuf might not be the same size as the animation itself
1762
+ * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
1763
+ *
1764
+ * This pixbuf should be displayed for gdk_pixbuf_animation_iter_get_delay_time()
1765
+ * milliseconds.
1766
+ *
1767
+ * The caller of this function does not own a reference to the returned
1768
+ * pixbuf; the returned pixbuf will become invalid when the iterator
1769
+ * advances to the next frame, which may happen anytime you call
1770
+ * gdk_pixbuf_animation_iter_advance().
1771
+ *
1772
+ * Copy the pixbuf to keep it (don't just add a reference), as it may get
1773
+ * recycled as you advance the iterator.
1774
+ * @returns the pixbuf to be displayed
1775
+ */
1776
+ get_pixbuf(): Pixbuf
1777
+ /**
1778
+ * Used to determine how to respond to the area_updated signal on
1779
+ * #GdkPixbufLoader when loading an animation.
1780
+ *
1781
+ * The `::area_updated` signal is emitted for an area of the frame currently
1782
+ * streaming in to the loader. So if you're on the currently loading frame,
1783
+ * you will need to redraw the screen for the updated area.
1784
+ * @returns `TRUE` if the frame we're on is partially loaded, or the last frame
1785
+ */
1786
+ on_currently_loading_frame(): boolean
1787
+
1788
+ // Own virtual methods of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1789
+
1790
+ /**
1791
+ * Possibly advances an animation to a new frame.
1792
+ *
1793
+ * Chooses the frame based on the start time passed to
1794
+ * gdk_pixbuf_animation_get_iter().
1795
+ *
1796
+ * `current_time` would normally come from g_get_current_time(), and
1797
+ * must be greater than or equal to the time passed to
1798
+ * gdk_pixbuf_animation_get_iter(), and must increase or remain
1799
+ * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
1800
+ * called. That is, you can't go backward in time; animations only
1801
+ * play forward.
1802
+ *
1803
+ * As a shortcut, pass `NULL` for the current time and g_get_current_time()
1804
+ * will be invoked on your behalf. So you only need to explicitly pass
1805
+ * `current_time` if you're doing something odd like playing the animation
1806
+ * at double speed.
1807
+ *
1808
+ * If this function returns `FALSE`, there's no need to update the animation
1809
+ * display, assuming the display had been rendered prior to advancing;
1810
+ * if `TRUE`, you need to call gdk_pixbuf_animation_iter_get_pixbuf()
1811
+ * and update the display with the new pixbuf.
1812
+ * @virtual
1813
+ * @param current_time current time
1814
+ * @returns `TRUE` if the image may need updating
1815
+ */
1816
+ vfunc_advance(current_time: GLib.TimeVal | null): boolean
1817
+ /**
1818
+ * Gets the number of milliseconds the current pixbuf should be displayed,
1819
+ * or -1 if the current pixbuf should be displayed forever.
1820
+ *
1821
+ * The `g_timeout_add()` function conveniently takes a timeout in milliseconds,
1822
+ * so you can use a timeout to schedule the next update.
1823
+ *
1824
+ * Note that some formats, like GIF, might clamp the timeout values in the
1825
+ * image file to avoid updates that are just too quick. The minimum timeout
1826
+ * for GIF images is currently 20 milliseconds.
1827
+ * @virtual
1828
+ * @returns delay time in milliseconds (thousandths of a second)
1829
+ */
1830
+ vfunc_get_delay_time(): number
1831
+ /**
1832
+ * Gets the current pixbuf which should be displayed.
1833
+ *
1834
+ * The pixbuf might not be the same size as the animation itself
1835
+ * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
1836
+ *
1837
+ * This pixbuf should be displayed for gdk_pixbuf_animation_iter_get_delay_time()
1838
+ * milliseconds.
1839
+ *
1840
+ * The caller of this function does not own a reference to the returned
1841
+ * pixbuf; the returned pixbuf will become invalid when the iterator
1842
+ * advances to the next frame, which may happen anytime you call
1843
+ * gdk_pixbuf_animation_iter_advance().
1844
+ *
1845
+ * Copy the pixbuf to keep it (don't just add a reference), as it may get
1846
+ * recycled as you advance the iterator.
1847
+ * @virtual
1848
+ * @returns the pixbuf to be displayed
1849
+ */
1850
+ vfunc_get_pixbuf(): Pixbuf
1851
+ /**
1852
+ * Used to determine how to respond to the area_updated signal on
1853
+ * #GdkPixbufLoader when loading an animation.
1854
+ *
1855
+ * The `::area_updated` signal is emitted for an area of the frame currently
1856
+ * streaming in to the loader. So if you're on the currently loading frame,
1857
+ * you will need to redraw the screen for the updated area.
1858
+ * @virtual
1859
+ * @returns `TRUE` if the frame we're on is partially loaded, or the last frame
1860
+ */
1861
+ vfunc_on_currently_loading_frame(): boolean
1862
+
1863
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1864
+
1865
+ connect(sigName: string, callback: (...args: any[]) => void): number
1866
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1867
+ emit(sigName: string, ...args: any[]): void
1868
+ disconnect(id: number): void
1869
+ }
1870
+
1871
+ /**
1872
+ * An opaque object representing an iterator which points to a
1873
+ * certain position in an animation.
1874
+ * @class
1875
+ */
1876
+ class PixbufAnimationIter extends GObject.Object {
1877
+
1878
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1879
+
1880
+ static name: string
1881
+ static $gtype: GObject.GType<PixbufAnimationIter>
1882
+
1883
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIter
1884
+
1885
+ constructor(config?: PixbufAnimationIter.ConstructorProperties)
1886
+ _init(config?: PixbufAnimationIter.ConstructorProperties): void
1887
+ }
1888
+
1889
+ module PixbufLoader {
1890
+
1891
+ // Signal callback interfaces
1892
+
1893
+ /**
1894
+ * Signal callback interface for `area-prepared`
1895
+ */
1896
+ interface AreaPreparedSignalCallback {
1897
+ ($obj: PixbufLoader): void
1898
+ }
1899
+
1900
+ /**
1901
+ * Signal callback interface for `area-updated`
1902
+ */
1903
+ interface AreaUpdatedSignalCallback {
1904
+ ($obj: PixbufLoader, x: number, y: number, width: number, height: number): void
1905
+ }
1906
+
1907
+ /**
1908
+ * Signal callback interface for `closed`
1909
+ */
1910
+ interface ClosedSignalCallback {
1911
+ ($obj: PixbufLoader): void
1912
+ }
1913
+
1914
+ /**
1915
+ * Signal callback interface for `size-prepared`
1916
+ */
1917
+ interface SizePreparedSignalCallback {
1918
+ ($obj: PixbufLoader, width: number, height: number): void
1919
+ }
1920
+
1921
+
1922
+ // Constructor properties interface
1923
+
1924
+ interface ConstructorProperties extends GObject.Object.ConstructorProperties {
1925
+ }
1926
+
1927
+ }
1928
+
1929
+ interface PixbufLoader {
1930
+
1931
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
1932
+
1933
+ /**
1934
+ * Informs a pixbuf loader that no further writes with
1935
+ * gdk_pixbuf_loader_write() will occur, so that it can free its
1936
+ * internal loading structures.
1937
+ *
1938
+ * This function also tries to parse any data that hasn't yet been parsed;
1939
+ * if the remaining data is partial or corrupt, an error will be returned.
1940
+ *
1941
+ * If `FALSE` is returned, `error` will be set to an error from the
1942
+ * `GDK_PIXBUF_ERROR` or `G_FILE_ERROR` domains.
1943
+ *
1944
+ * If you're just cancelling a load rather than expecting it to be finished,
1945
+ * passing `NULL` for `error` to ignore it is reasonable.
1946
+ *
1947
+ * Remember that this function does not release a reference on the loader, so
1948
+ * you will need to explicitly release any reference you hold.
1949
+ * @returns `TRUE` if all image data written so far was successfully passed out via the update_area signal
1950
+ */
1951
+ close(): boolean
1952
+ /**
1953
+ * Queries the #GdkPixbufAnimation that a pixbuf loader is currently creating.
1954
+ *
1955
+ * In general it only makes sense to call this function after the
1956
+ * [signal`GdkPixbuf`.PixbufLoader::area-prepared] signal has been emitted by
1957
+ * the loader.
1958
+ *
1959
+ * If the loader doesn't have enough bytes yet, and hasn't emitted the `area-prepared`
1960
+ * signal, this function will return `NULL`.
1961
+ * @returns The animation that the loader is currently loading
1962
+ */
1963
+ get_animation(): PixbufAnimation | null
1964
+ /**
1965
+ * Obtains the available information about the format of the
1966
+ * currently loading image file.
1967
+ * @returns A #GdkPixbufFormat
1968
+ */
1969
+ get_format(): PixbufFormat | null
1970
+ /**
1971
+ * Queries the #GdkPixbuf that a pixbuf loader is currently creating.
1972
+ *
1973
+ * In general it only makes sense to call this function after the
1974
+ * [signal`GdkPixbuf`.PixbufLoader::area-prepared] signal has been
1975
+ * emitted by the loader; this means that enough data has been read
1976
+ * to know the size of the image that will be allocated.
1977
+ *
1978
+ * If the loader has not received enough data via gdk_pixbuf_loader_write(),
1979
+ * then this function returns `NULL`.
1980
+ *
1981
+ * The returned pixbuf will be the same in all future calls to the loader,
1982
+ * so if you want to keep using it, you should acquire a reference to it.
1983
+ *
1984
+ * Additionally, if the loader is an animation, it will return the "static
1985
+ * image" of the animation (see gdk_pixbuf_animation_get_static_image()).
1986
+ * @returns The pixbuf that the loader is creating
1987
+ */
1988
+ get_pixbuf(): Pixbuf | null
1989
+ /**
1990
+ * Causes the image to be scaled while it is loaded.
1991
+ *
1992
+ * The desired image size can be determined relative to the original
1993
+ * size of the image by calling gdk_pixbuf_loader_set_size() from a
1994
+ * signal handler for the ::size-prepared signal.
1995
+ *
1996
+ * Attempts to set the desired image size are ignored after the
1997
+ * emission of the ::size-prepared signal.
1998
+ * @param width The desired width of the image being loaded.
1999
+ * @param height The desired height of the image being loaded.
2000
+ */
2001
+ set_size(width: number, height: number): void
2002
+ /**
2003
+ * Parses the next `count` bytes in the given image buffer.
2004
+ * @param buf Pointer to image data.
2005
+ * @returns `TRUE` if the write was successful, or `FALSE` if the loader cannot parse the buffer
2006
+ */
2007
+ write(buf: Uint8Array): boolean
2008
+ /**
2009
+ * Parses the next contents of the given image buffer.
2010
+ * @param buffer The image data as a `GBytes` buffer.
2011
+ * @returns `TRUE` if the write was successful, or `FALSE` if the loader cannot parse the buffer
2012
+ */
2013
+ write_bytes(buffer: GLib.Bytes): boolean
2014
+
2015
+ // Own virtual methods of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
2016
+
2017
+ vfunc_area_prepared(): void
2018
+ vfunc_area_updated(x: number, y: number, width: number, height: number): void
2019
+ vfunc_closed(): void
2020
+ vfunc_size_prepared(width: number, height: number): void
2021
+
2022
+ // Own signals of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
2023
+
2024
+ connect(sigName: "area-prepared", callback: PixbufLoader.AreaPreparedSignalCallback): number
2025
+ connect_after(sigName: "area-prepared", callback: PixbufLoader.AreaPreparedSignalCallback): number
2026
+ emit(sigName: "area-prepared", ...args: any[]): void
2027
+ connect(sigName: "area-updated", callback: PixbufLoader.AreaUpdatedSignalCallback): number
2028
+ connect_after(sigName: "area-updated", callback: PixbufLoader.AreaUpdatedSignalCallback): number
2029
+ emit(sigName: "area-updated", x: number, y: number, width: number, height: number, ...args: any[]): void
2030
+ connect(sigName: "closed", callback: PixbufLoader.ClosedSignalCallback): number
2031
+ connect_after(sigName: "closed", callback: PixbufLoader.ClosedSignalCallback): number
2032
+ emit(sigName: "closed", ...args: any[]): void
2033
+ connect(sigName: "size-prepared", callback: PixbufLoader.SizePreparedSignalCallback): number
2034
+ connect_after(sigName: "size-prepared", callback: PixbufLoader.SizePreparedSignalCallback): number
2035
+ emit(sigName: "size-prepared", width: number, height: number, ...args: any[]): void
2036
+
2037
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
2038
+
2039
+ connect(sigName: string, callback: (...args: any[]) => void): number
2040
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2041
+ emit(sigName: string, ...args: any[]): void
2042
+ disconnect(id: number): void
2043
+ }
2044
+
2045
+ /**
2046
+ * Incremental image loader.
2047
+ *
2048
+ * `GdkPixbufLoader` provides a way for applications to drive the
2049
+ * process of loading an image, by letting them send the image data
2050
+ * directly to the loader instead of having the loader read the data
2051
+ * from a file. Applications can use this functionality instead of
2052
+ * `gdk_pixbuf_new_from_file()` or `gdk_pixbuf_animation_new_from_file()`
2053
+ * when they need to parse image data in small chunks. For example,
2054
+ * it should be used when reading an image from a (potentially) slow
2055
+ * network connection, or when loading an extremely large file.
2056
+ *
2057
+ * To use `GdkPixbufLoader` to load an image, create a new instance,
2058
+ * and call [method`GdkPixbuf`.PixbufLoader.write] to send the data
2059
+ * to it. When done, [method`GdkPixbuf`.PixbufLoader.close] should be
2060
+ * called to end the stream and finalize everything.
2061
+ *
2062
+ * The loader will emit three important signals throughout the process:
2063
+ *
2064
+ * - [signal`GdkPixbuf`.PixbufLoader::size-prepared] will be emitted as
2065
+ * soon as the image has enough information to determine the size of
2066
+ * the image to be used. If you want to scale the image while loading
2067
+ * it, you can call [method`GdkPixbuf`.PixbufLoader.set_size] in
2068
+ * response to this signal.
2069
+ * - [signal`GdkPixbuf`.PixbufLoader::area-prepared] will be emitted as
2070
+ * soon as the pixbuf of the desired has been allocated. You can obtain
2071
+ * the `GdkPixbuf` instance by calling [method`GdkPixbuf`.PixbufLoader.get_pixbuf].
2072
+ * If you want to use it, simply acquire a reference to it. You can
2073
+ * also call `gdk_pixbuf_loader_get_pixbuf()` later to get the same
2074
+ * pixbuf.
2075
+ * - [signal`GdkPixbuf`.PixbufLoader::area-updated] will be emitted every
2076
+ * time a region is updated. This way you can update a partially
2077
+ * completed image. Note that you do not know anything about the
2078
+ * completeness of an image from the updated area. For example, in an
2079
+ * interlaced image you will need to make several passes before the
2080
+ * image is done loading.
2081
+ *
2082
+ * ## Loading an animation
2083
+ *
2084
+ * Loading an animation is almost as easy as loading an image. Once the
2085
+ * first [signal`GdkPixbuf`.PixbufLoader::area-prepared] signal has been
2086
+ * emitted, you can call [method`GdkPixbuf`.PixbufLoader.get_animation] to
2087
+ * get the [class`GdkPixbuf`.PixbufAnimation] instance, and then call
2088
+ * and [method`GdkPixbuf`.PixbufAnimation.get_iter] to get a
2089
+ * [class`GdkPixbuf`.PixbufAnimationIter] to retrieve the pixbuf for the
2090
+ * desired time stamp.
2091
+ * @class
2092
+ */
2093
+ class PixbufLoader extends GObject.Object {
2094
+
2095
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
2096
+
2097
+ static name: string
2098
+ static $gtype: GObject.GType<PixbufLoader>
2099
+
2100
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufLoader
2101
+
2102
+ constructor(config?: PixbufLoader.ConstructorProperties)
2103
+ /**
2104
+ * Creates a new pixbuf loader object.
2105
+ * @constructor
2106
+ * @returns A newly-created pixbuf loader.
2107
+ */
2108
+ constructor()
2109
+ /**
2110
+ * Creates a new pixbuf loader object.
2111
+ * @constructor
2112
+ * @returns A newly-created pixbuf loader.
2113
+ */
2114
+ static new(): PixbufLoader
2115
+ /**
2116
+ * Creates a new pixbuf loader object that always attempts to parse
2117
+ * image data as if it were an image of MIME type `mime_type,` instead of
2118
+ * identifying the type automatically.
2119
+ *
2120
+ * This function is useful if you want an error if the image isn't the
2121
+ * expected MIME type; for loading image formats that can't be reliably
2122
+ * identified by looking at the data; or if the user manually forces a
2123
+ * specific MIME type.
2124
+ *
2125
+ * The list of supported mime types depends on what image loaders
2126
+ * are installed, but typically "image/png", "image/jpeg", "image/gif",
2127
+ * "image/tiff" and "image/x-xpixmap" are among the supported mime types.
2128
+ * To obtain the full list of supported mime types, call
2129
+ * gdk_pixbuf_format_get_mime_types() on each of the #GdkPixbufFormat
2130
+ * structs returned by gdk_pixbuf_get_formats().
2131
+ * @constructor
2132
+ * @param mime_type the mime type to be loaded
2133
+ * @returns A newly-created pixbuf loader.
2134
+ */
2135
+ static new_with_mime_type(mime_type: string | null): PixbufLoader
2136
+ /**
2137
+ * Creates a new pixbuf loader object that always attempts to parse
2138
+ * image data as if it were an image of type `image_type,` instead of
2139
+ * identifying the type automatically.
2140
+ *
2141
+ * This function is useful if you want an error if the image isn't the
2142
+ * expected type; for loading image formats that can't be reliably
2143
+ * identified by looking at the data; or if the user manually forces
2144
+ * a specific type.
2145
+ *
2146
+ * The list of supported image formats depends on what image loaders
2147
+ * are installed, but typically "png", "jpeg", "gif", "tiff" and
2148
+ * "xpm" are among the supported formats. To obtain the full list of
2149
+ * supported image formats, call gdk_pixbuf_format_get_name() on each
2150
+ * of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
2151
+ * @constructor
2152
+ * @param image_type name of the image format to be loaded with the image
2153
+ * @returns A newly-created pixbuf loader.
2154
+ */
2155
+ static new_with_type(image_type: string | null): PixbufLoader
2156
+ _init(config?: PixbufLoader.ConstructorProperties): void
2157
+ }
2158
+
2159
+ module PixbufNonAnim {
2160
+
2161
+ // Constructor properties interface
2162
+
2163
+ interface ConstructorProperties extends PixbufAnimation.ConstructorProperties {
2164
+ }
2165
+
2166
+ }
2167
+
2168
+ interface PixbufNonAnim {
2169
+
2170
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufNonAnim
2171
+
2172
+ connect(sigName: string, callback: (...args: any[]) => void): number
2173
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2174
+ emit(sigName: string, ...args: any[]): void
2175
+ disconnect(id: number): void
2176
+ }
2177
+
2178
+ class PixbufNonAnim extends PixbufAnimation {
2179
+
2180
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufNonAnim
2181
+
2182
+ static name: string
2183
+ static $gtype: GObject.GType<PixbufNonAnim>
2184
+
2185
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufNonAnim
2186
+
2187
+ constructor(config?: PixbufNonAnim.ConstructorProperties)
2188
+ constructor(pixbuf: Pixbuf)
2189
+ static new(pixbuf: Pixbuf): PixbufNonAnim
2190
+ _init(config?: PixbufNonAnim.ConstructorProperties): void
2191
+ }
2192
+
2193
+ module PixbufSimpleAnim {
2194
+
2195
+ // Constructor properties interface
2196
+
2197
+ interface ConstructorProperties extends PixbufAnimation.ConstructorProperties {
2198
+
2199
+ // Own constructor properties of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2200
+
2201
+ /**
2202
+ * Whether the animation should loop when it reaches the end.
2203
+ */
2204
+ loop?: boolean | null
2205
+ }
2206
+
2207
+ }
2208
+
2209
+ interface PixbufSimpleAnim {
2210
+
2211
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2212
+
2213
+ /**
2214
+ * Whether the animation should loop when it reaches the end.
2215
+ */
2216
+ loop: boolean
2217
+
2218
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2219
+
2220
+ /**
2221
+ * Adds a new frame to `animation`. The `pixbuf` must
2222
+ * have the dimensions specified when the animation
2223
+ * was constructed.
2224
+ * @param pixbuf the pixbuf to add
2225
+ */
2226
+ add_frame(pixbuf: Pixbuf): void
2227
+ /**
2228
+ * Gets whether `animation` should loop indefinitely when it reaches the end.
2229
+ * @returns %TRUE if the animation loops forever, %FALSE otherwise
2230
+ */
2231
+ get_loop(): boolean
2232
+ /**
2233
+ * Sets whether `animation` should loop indefinitely when it reaches the end.
2234
+ * @param loop whether to loop the animation
2235
+ */
2236
+ set_loop(loop: boolean): void
2237
+
2238
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2239
+
2240
+ connect(sigName: "notify::loop", callback: (($obj: PixbufSimpleAnim, pspec: GObject.ParamSpec) => void)): number
2241
+ connect_after(sigName: "notify::loop", callback: (($obj: PixbufSimpleAnim, pspec: GObject.ParamSpec) => void)): number
2242
+ emit(sigName: "notify::loop", ...args: any[]): void
2243
+ connect(sigName: string, callback: (...args: any[]) => void): number
2244
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2245
+ emit(sigName: string, ...args: any[]): void
2246
+ disconnect(id: number): void
2247
+ }
2248
+
2249
+ /**
2250
+ * An opaque struct representing a simple animation.
2251
+ * @class
2252
+ */
2253
+ class PixbufSimpleAnim extends PixbufAnimation {
2254
+
2255
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2256
+
2257
+ static name: string
2258
+ static $gtype: GObject.GType<PixbufSimpleAnim>
2259
+
2260
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnim
2261
+
2262
+ constructor(config?: PixbufSimpleAnim.ConstructorProperties)
2263
+ /**
2264
+ * Creates a new, empty animation.
2265
+ * @constructor
2266
+ * @param width the width of the animation
2267
+ * @param height the height of the animation
2268
+ * @param rate the speed of the animation, in frames per second
2269
+ * @returns a newly allocated #GdkPixbufSimpleAnim
2270
+ */
2271
+ constructor(width: number, height: number, rate: number)
2272
+ /**
2273
+ * Creates a new, empty animation.
2274
+ * @constructor
2275
+ * @param width the width of the animation
2276
+ * @param height the height of the animation
2277
+ * @param rate the speed of the animation, in frames per second
2278
+ * @returns a newly allocated #GdkPixbufSimpleAnim
2279
+ */
2280
+ static new(width: number, height: number, rate: number): PixbufSimpleAnim
2281
+ _init(config?: PixbufSimpleAnim.ConstructorProperties): void
2282
+ }
2283
+
2284
+ module PixbufSimpleAnimIter {
2285
+
2286
+ // Constructor properties interface
2287
+
2288
+ interface ConstructorProperties extends PixbufAnimationIter.ConstructorProperties {
2289
+ }
2290
+
2291
+ }
2292
+
2293
+ interface PixbufSimpleAnimIter {
2294
+
2295
+ // Class property signals of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnimIter
2296
+
2297
+ connect(sigName: string, callback: (...args: any[]) => void): number
2298
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2299
+ emit(sigName: string, ...args: any[]): void
2300
+ disconnect(id: number): void
2301
+ }
2302
+
2303
+ class PixbufSimpleAnimIter extends PixbufAnimationIter {
2304
+
2305
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnimIter
2306
+
2307
+ static name: string
2308
+ static $gtype: GObject.GType<PixbufSimpleAnimIter>
2309
+
2310
+ // Constructors of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnimIter
2311
+
2312
+ constructor(config?: PixbufSimpleAnimIter.ConstructorProperties)
2313
+ _init(config?: PixbufSimpleAnimIter.ConstructorProperties): void
2314
+ }
2315
+
2316
+ interface PixbufAnimationClass {
2317
+
2318
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationClass
2319
+
2320
+ /**
2321
+ * the parent class
2322
+ * @field
2323
+ */
2324
+ parent_class: GObject.ObjectClass
2325
+ is_static_image: (animation: PixbufAnimation) => boolean
2326
+ get_static_image: (animation: PixbufAnimation) => Pixbuf
2327
+ get_size: (animation: PixbufAnimation, width: number, height: number) => void
2328
+ get_iter: (animation: PixbufAnimation, start_time: GLib.TimeVal | null) => PixbufAnimationIter
2329
+ }
2330
+
2331
+ /**
2332
+ * Modules supporting animations must derive a type from
2333
+ * #GdkPixbufAnimation, providing suitable implementations of the
2334
+ * virtual functions.
2335
+ * @record
2336
+ */
2337
+ abstract class PixbufAnimationClass {
2338
+
2339
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationClass
2340
+
2341
+ static name: string
2342
+ }
2343
+
2344
+ interface PixbufAnimationIterClass {
2345
+
2346
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIterClass
2347
+
2348
+ /**
2349
+ * the parent class
2350
+ * @field
2351
+ */
2352
+ parent_class: GObject.ObjectClass
2353
+ get_delay_time: (iter: PixbufAnimationIter) => number
2354
+ get_pixbuf: (iter: PixbufAnimationIter) => Pixbuf
2355
+ on_currently_loading_frame: (iter: PixbufAnimationIter) => boolean
2356
+ advance: (iter: PixbufAnimationIter, current_time: GLib.TimeVal | null) => boolean
2357
+ }
2358
+
2359
+ /**
2360
+ * Modules supporting animations must derive a type from
2361
+ * #GdkPixbufAnimationIter, providing suitable implementations of the
2362
+ * virtual functions.
2363
+ * @record
2364
+ */
2365
+ abstract class PixbufAnimationIterClass {
2366
+
2367
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufAnimationIterClass
2368
+
2369
+ static name: string
2370
+ }
2371
+
2372
+ interface PixbufFormat {
2373
+
2374
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufFormat
2375
+
2376
+ /**
2377
+ * the name of the image format
2378
+ * @field
2379
+ */
2380
+ name: string | null
2381
+ /**
2382
+ * the signature of the module
2383
+ * @field
2384
+ */
2385
+ signature: PixbufModulePattern
2386
+ /**
2387
+ * the message domain for the `description`
2388
+ * @field
2389
+ */
2390
+ domain: string | null
2391
+ /**
2392
+ * a description of the image format
2393
+ * @field
2394
+ */
2395
+ description: string | null
2396
+ /**
2397
+ * the MIME types for the image format
2398
+ * @field
2399
+ */
2400
+ mime_types: string[]
2401
+ /**
2402
+ * typical filename extensions for the
2403
+ * image format
2404
+ * @field
2405
+ */
2406
+ extensions: string[]
2407
+ /**
2408
+ * a combination of `GdkPixbufFormatFlags`
2409
+ * @field
2410
+ */
2411
+ flags: number
2412
+ /**
2413
+ * a boolean determining whether the loader is disabled`
2414
+ * @field
2415
+ */
2416
+ disabled: boolean
2417
+ /**
2418
+ * a string containing license information, typically set to
2419
+ * shorthands like "GPL", "LGPL", etc.
2420
+ * @field
2421
+ */
2422
+ license: string | null
2423
+
2424
+ // Owm methods of GdkPixbuf-2.0.GdkPixbuf.PixbufFormat
2425
+
2426
+ /**
2427
+ * Creates a copy of `format`.
2428
+ * @returns the newly allocated copy of a `GdkPixbufFormat`. Use gdk_pixbuf_format_free() to free the resources when done
2429
+ */
2430
+ copy(): PixbufFormat
2431
+ /**
2432
+ * Frees the resources allocated when copying a `GdkPixbufFormat`
2433
+ * using gdk_pixbuf_format_copy()
2434
+ */
2435
+ free(): void
2436
+ /**
2437
+ * Returns a description of the format.
2438
+ * @returns a description of the format.
2439
+ */
2440
+ get_description(): string | null
2441
+ /**
2442
+ * Returns the filename extensions typically used for files in the
2443
+ * given format.
2444
+ * @returns an array of filename extensions
2445
+ */
2446
+ get_extensions(): string[]
2447
+ /**
2448
+ * Returns information about the license of the image loader for the format.
2449
+ *
2450
+ * The returned string should be a shorthand for a well known license, e.g.
2451
+ * "LGPL", "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license.
2452
+ * @returns a string describing the license of the pixbuf format
2453
+ */
2454
+ get_license(): string | null
2455
+ /**
2456
+ * Returns the mime types supported by the format.
2457
+ * @returns an array of mime types
2458
+ */
2459
+ get_mime_types(): string[]
2460
+ /**
2461
+ * Returns the name of the format.
2462
+ * @returns the name of the format.
2463
+ */
2464
+ get_name(): string | null
2465
+ /**
2466
+ * Returns whether this image format is disabled.
2467
+ *
2468
+ * See gdk_pixbuf_format_set_disabled().
2469
+ * @returns whether this image format is disabled.
2470
+ */
2471
+ is_disabled(): boolean
2472
+ /**
2473
+ * Returns `TRUE` if the save option specified by `option_key` is supported when
2474
+ * saving a pixbuf using the module implementing `format`.
2475
+ *
2476
+ * See gdk_pixbuf_save() for more information about option keys.
2477
+ * @param option_key the name of an option
2478
+ * @returns `TRUE` if the specified option is supported
2479
+ */
2480
+ is_save_option_supported(option_key: string | null): boolean
2481
+ /**
2482
+ * Returns whether this image format is scalable.
2483
+ *
2484
+ * If a file is in a scalable format, it is preferable to load it at
2485
+ * the desired size, rather than loading it at the default size and
2486
+ * scaling the resulting pixbuf to the desired size.
2487
+ * @returns whether this image format is scalable.
2488
+ */
2489
+ is_scalable(): boolean
2490
+ /**
2491
+ * Returns whether pixbufs can be saved in the given format.
2492
+ * @returns whether pixbufs can be saved in the given format.
2493
+ */
2494
+ is_writable(): boolean
2495
+ /**
2496
+ * Disables or enables an image format.
2497
+ *
2498
+ * If a format is disabled, GdkPixbuf won't use the image loader for
2499
+ * this format to load images.
2500
+ *
2501
+ * Applications can use this to avoid using image loaders with an
2502
+ * inappropriate license, see gdk_pixbuf_format_get_license().
2503
+ * @param disabled `TRUE` to disable the format `format`
2504
+ */
2505
+ set_disabled(disabled: boolean): void
2506
+ }
2507
+
2508
+ /**
2509
+ * A `GdkPixbufFormat` contains information about the image format accepted
2510
+ * by a module.
2511
+ *
2512
+ * Only modules should access the fields directly, applications should
2513
+ * use the `gdk_pixbuf_format_*` family of functions.
2514
+ * @record
2515
+ */
2516
+ class PixbufFormat {
2517
+
2518
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufFormat
2519
+
2520
+ static name: string
2521
+ }
2522
+
2523
+ interface PixbufLoaderClass {
2524
+
2525
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufLoaderClass
2526
+
2527
+ parent_class: GObject.ObjectClass
2528
+ size_prepared: (loader: PixbufLoader, width: number, height: number) => void
2529
+ area_prepared: (loader: PixbufLoader) => void
2530
+ area_updated: (loader: PixbufLoader, x: number, y: number, width: number, height: number) => void
2531
+ closed: (loader: PixbufLoader) => void
2532
+ }
2533
+
2534
+ abstract class PixbufLoaderClass {
2535
+
2536
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufLoaderClass
2537
+
2538
+ static name: string
2539
+ }
2540
+
2541
+ interface PixbufModule {
2542
+
2543
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufModule
2544
+
2545
+ /**
2546
+ * the name of the module, usually the same as the
2547
+ * usual file extension for images of this type, eg. "xpm", "jpeg" or "png".
2548
+ * @field
2549
+ */
2550
+ module_name: string | null
2551
+ /**
2552
+ * the path from which the module is loaded.
2553
+ * @field
2554
+ */
2555
+ module_path: string | null
2556
+ /**
2557
+ * the loaded `GModule`.
2558
+ * @field
2559
+ */
2560
+ module: GModule.Module
2561
+ /**
2562
+ * a `GdkPixbufFormat` holding information about the module.
2563
+ * @field
2564
+ */
2565
+ info: PixbufFormat
2566
+ stop_load: (context: any) => boolean
2567
+ load_increment: (context: any, buf: number, size: number) => boolean
2568
+ save: (f: any, pixbuf: Pixbuf, param_keys: string | null, param_values: string | null) => boolean
2569
+ is_save_option_supported: (option_key: string | null) => boolean
2570
+ }
2571
+
2572
+ /**
2573
+ * A `GdkPixbufModule` contains the necessary functions to load and save
2574
+ * images in a certain file format.
2575
+ *
2576
+ * If `GdkPixbuf` has been compiled with `GModule` support, it can be extended
2577
+ * by modules which can load (and perhaps also save) new image and animation
2578
+ * formats.
2579
+ *
2580
+ * ## Implementing modules
2581
+ *
2582
+ * The `GdkPixbuf` interfaces needed for implementing modules are contained in
2583
+ * `gdk-pixbuf-io.h` (and `gdk-pixbuf-animation.h` if the module supports
2584
+ * animations). They are not covered by the same stability guarantees as the
2585
+ * regular GdkPixbuf API. To underline this fact, they are protected by the
2586
+ * `GDK_PIXBUF_ENABLE_BACKEND` pre-processor symbol.
2587
+ *
2588
+ * Each loadable module must contain a `GdkPixbufModuleFillVtableFunc` function
2589
+ * named `fill_vtable`, which will get called when the module
2590
+ * is loaded and must set the function pointers of the `GdkPixbufModule`.
2591
+ *
2592
+ * In order to make format-checking work before actually loading the modules
2593
+ * (which may require calling `dlopen` to load image libraries), modules export
2594
+ * their signatures (and other information) via the `fill_info` function. An
2595
+ * external utility, `gdk-pixbuf-query-loaders`, uses this to create a text
2596
+ * file containing a list of all available loaders and their signatures.
2597
+ * This file is then read at runtime by `GdkPixbuf` to obtain the list of
2598
+ * available loaders and their signatures.
2599
+ *
2600
+ * Modules may only implement a subset of the functionality available via
2601
+ * `GdkPixbufModule`. If a particular functionality is not implemented, the
2602
+ * `fill_vtable` function will simply not set the corresponding
2603
+ * function pointers of the `GdkPixbufModule` structure. If a module supports
2604
+ * incremental loading (i.e. provides `begin_load`, `stop_load` and
2605
+ * `load_increment`), it doesn't have to implement `load`, since `GdkPixbuf`
2606
+ * can supply a generic `load` implementation wrapping the incremental loading.
2607
+ *
2608
+ * ## Installing modules
2609
+ *
2610
+ * Installing a module is a two-step process:
2611
+ *
2612
+ * - copy the module file(s) to the loader directory (normally
2613
+ * `$libdir/gdk-pixbuf-2.0/$version/loaders`, unless overridden by the
2614
+ * environment variable `GDK_PIXBUF_MODULEDIR`)
2615
+ * - call `gdk-pixbuf-query-loaders` to update the module file (normally
2616
+ * `$libdir/gdk-pixbuf-2.0/$version/loaders.cache`, unless overridden
2617
+ * by the environment variable `GDK_PIXBUF_MODULE_FILE`)
2618
+ * @record
2619
+ */
2620
+ class PixbufModule {
2621
+
2622
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufModule
2623
+
2624
+ static name: string
2625
+ }
2626
+
2627
+ interface PixbufModulePattern {
2628
+
2629
+ // Own fields of GdkPixbuf-2.0.GdkPixbuf.PixbufModulePattern
2630
+
2631
+ /**
2632
+ * the prefix for this pattern
2633
+ * @field
2634
+ */
2635
+ prefix: string | null
2636
+ /**
2637
+ * mask containing bytes which modify how the prefix is matched against
2638
+ * test data
2639
+ * @field
2640
+ */
2641
+ mask: string | null
2642
+ /**
2643
+ * relevance of this pattern
2644
+ * @field
2645
+ */
2646
+ relevance: number
2647
+ }
2648
+
2649
+ /**
2650
+ * The signature prefix for a module.
2651
+ *
2652
+ * The signature of a module is a set of prefixes. Prefixes are encoded as
2653
+ * pairs of ordinary strings, where the second string, called the mask, if
2654
+ * not `NULL`, must be of the same length as the first one and may contain
2655
+ * ' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched,
2656
+ * not matched, "don't-care"-bytes, zeros and non-zeros, respectively.
2657
+ *
2658
+ * Each prefix has an associated integer that describes the relevance of
2659
+ * the prefix, with 0 meaning a mismatch and 100 a "perfect match".
2660
+ *
2661
+ * Starting with gdk-pixbuf 2.8, the first byte of the mask may be '*',
2662
+ * indicating an unanchored pattern that matches not only at the beginning,
2663
+ * but also in the middle. Versions prior to 2.8 will interpret the '*'
2664
+ * like an 'x'.
2665
+ *
2666
+ * The signature of a module is stored as an array of
2667
+ * `GdkPixbufModulePatterns`. The array is terminated by a pattern
2668
+ * where the `prefix` is `NULL`.
2669
+ *
2670
+ * ```c
2671
+ * GdkPixbufModulePattern *signature[] = {
2672
+ * { "abcdx", " !x z", 100 },
2673
+ * { "bla", NULL, 90 },
2674
+ * { NULL, NULL, 0 }
2675
+ * };
2676
+ * ```
2677
+ *
2678
+ * In the example above, the signature matches e.g. "auud\0" with
2679
+ * relevance 100, and "blau" with relevance 90.
2680
+ * @record
2681
+ */
2682
+ class PixbufModulePattern {
2683
+
2684
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufModulePattern
2685
+
2686
+ static name: string
2687
+ }
2688
+
2689
+ interface PixbufSimpleAnimClass {
2690
+ }
2691
+
2692
+ abstract class PixbufSimpleAnimClass {
2693
+
2694
+ // Own properties of GdkPixbuf-2.0.GdkPixbuf.PixbufSimpleAnimClass
2695
+
2696
+ static name: string
2697
+ }
2698
+
2699
+ /**
2700
+ * Name of the imported GIR library
2701
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
2702
+ */
2703
+ const __name__: string
2704
+ /**
2705
+ * Version of the imported GIR library
2706
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
2707
+ */
2708
+ const __version__: string
2709
+ }
2710
+
2711
+ export default GdkPixbuf;
2712
+ // END