v0.2.1 c0399be

gdk-pixbuf.go RawHistoryFolder

1// Package gdkpixbuf was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdkpixbuf
3
4import (
5	"unsafe"
6
7	"github.com/ebitengine/purego"
8
9	"github.com/bnema/puregotk/pkg/core"
10	"github.com/bnema/puregotk/v4/gio"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// A pixel buffer.
17//
18// `GdkPixbuf` contains information about an image's pixel data,
19// its color space, bits per sample, width and height, and the
20// rowstride (the number of bytes between the start of one row
21// and the start of the next).
22//
23// ## Creating new `GdkPixbuf`
24//
25// The most basic way to create a pixbuf is to wrap an existing pixel
26// buffer with a [class@GdkPixbuf.Pixbuf] instance. You can use the
27// [`ctor@GdkPixbuf.Pixbuf.new_from_data`] function to do this.
28//
29// Every time you create a new `GdkPixbuf` instance for some data, you
30// will need to specify the destroy notification function that will be
31// called when the data buffer needs to be freed; this will happen when
32// a `GdkPixbuf` is finalized by the reference counting functions. If
33// you have a chunk of static data compiled into your application, you
34// can pass in `NULL` as the destroy notification function so that the
35// data will not be freed.
36//
37// The [`ctor@GdkPixbuf.Pixbuf.new`] constructor function can be used
38// as a convenience to create a pixbuf with an empty buffer; this is
39// equivalent to allocating a data buffer using `malloc()` and then
40// wrapping it with `gdk_pixbuf_new_from_data()`. The `gdk_pixbuf_new()`
41// function will compute an optimal rowstride so that rendering can be
42// performed with an efficient algorithm.
43//
44// You can also copy an existing pixbuf with the [method@Pixbuf.copy]
45// function. This is not the same as just acquiring a reference to
46// the old pixbuf instance: the copy function will actually duplicate
47// the pixel data in memory and create a new [class@Pixbuf] instance
48// for it.
49//
50// ## Reference counting
51//
52// `GdkPixbuf` structures are reference counted. This means that an
53// application can share a single pixbuf among many parts of the
54// code. When a piece of the program needs to use a pixbuf, it should
55// acquire a reference to it by calling `g_object_ref()`; when it no
56// longer needs the pixbuf, it should release the reference it acquired
57// by calling `g_object_unref()`. The resources associated with a
58// `GdkPixbuf` will be freed when its reference count drops to zero.
59// Newly-created `GdkPixbuf` instances start with a reference count
60// of one.
61//
62// ## Image Data
63//
64// Image data in a pixbuf is stored in memory in an uncompressed,
65// packed format. Rows in the image are stored top to bottom, and
66// in each row pixels are stored from left to right.
67//
68// There may be padding at the end of a row.
69//
70// The "rowstride" value of a pixbuf, as returned by [`method@GdkPixbuf.Pixbuf.get_rowstride`],
71// indicates the number of bytes between rows.
72//
73// **NOTE**: If you are copying raw pixbuf data with `memcpy()` note that the
74// last row in the pixbuf may not be as wide as the full rowstride, but rather
75// just as wide as the pixel data needs to be; that is: it is unsafe to do
76// `memcpy (dest, pixels, rowstride * height)` to copy a whole pixbuf. Use
77// [method@GdkPixbuf.Pixbuf.copy] instead, or compute the width in bytes of the
78// last row as:
79//
80// ```c
81// last_row = width * ((n_channels * bits_per_sample + 7) / 8);
82// ```
83//
84// The same rule applies when iterating over each row of a `GdkPixbuf` pixels
85// array.
86//
87// The following code illustrates a simple `put_pixel()`
88// function for RGB pixbufs with 8 bits per channel with an alpha
89// channel.
90//
91// ```c
92// static void
93// put_pixel (GdkPixbuf *pixbuf,
94//
95//	           int x,
96//		   int y,
97//		   guchar red,
98//		   guchar green,
99//		   guchar blue,
100//		   guchar alpha)
101//
102//	{
103//	  int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
104//
105//	  // Ensure that the pixbuf is valid
106//	  g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
107//	  g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
108//	  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
109//	  g_assert (n_channels == 4);
110//
111//	  int width = gdk_pixbuf_get_width (pixbuf);
112//	  int height = gdk_pixbuf_get_height (pixbuf);
113//
114//	  // Ensure that the coordinates are in a valid range
115//	  g_assert (x >= 0 && x < width);
116//	  g_assert (y >= 0 && y < height);
117//
118//	  int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
119//
120//	  // The pixel buffer in the GdkPixbuf instance
121//	  guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);
122//
123//	  // The pixel we wish to modify
124//	  guchar *p = pixels + y * rowstride + x * n_channels;
125//	  p[0] = red;
126//	  p[1] = green;
127//	  p[2] = blue;
128//	  p[3] = alpha;
129//	}
130//
131// ```
132//
133// ## Loading images
134//
135// The `GdkPixBuf` class provides a simple mechanism for loading
136// an image from a file in synchronous and asynchronous fashion.
137//
138// For GUI applications, it is recommended to use the asynchronous
139// stream API to avoid blocking the control flow of the application.
140//
141// Additionally, `GdkPixbuf` provides the [class@GdkPixbuf.PixbufLoader`]
142// API for progressive image loading.
143//
144// ## Saving images
145//
146// The `GdkPixbuf` class provides methods for saving image data in
147// a number of file formats. The formatted data can be written to a
148// file or to a memory buffer. `GdkPixbuf` can also call a user-defined
149// callback on the data, which allows to e.g. write the image
150// to a socket or store it in a database.
151type Pixbuf struct {
152	gobject.Object
153}
154
155var xPixbufGLibType func() types.GType
156
157func PixbufGLibType() types.GType {
158	return xPixbufGLibType()
159}
160
161func PixbufNewFromInternalPtr(ptr uintptr) *Pixbuf {
162	cls := &Pixbuf{}
163	cls.Ptr = ptr
164	return cls
165}
166
167var xNewPixbuf func(Colorspace, bool, int, int, int) uintptr
168
169// Creates a new `GdkPixbuf` structure and allocates a buffer for it.
170//
171// If the allocation of the buffer failed, this function will return `NULL`.
172//
173// The buffer has an optimal rowstride. Note that the buffer is not cleared;
174// you will have to fill it completely yourself.
175func NewPixbuf(ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int) *Pixbuf {
176	var cls *Pixbuf
177
178	cret := xNewPixbuf(ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar)
179
180	if cret == 0 {
181		return nil
182	}
183	cls = &Pixbuf{}
184	cls.Ptr = cret
185	return cls
186}
187
188var xNewPixbufFromBytes func(*glib.Bytes, Colorspace, bool, int, int, int, int) uintptr
189
190// Creates a new #GdkPixbuf out of in-memory readonly image data.
191//
192// Currently only RGB images with 8 bits per sample are supported.
193//
194// This is the `GBytes` variant of gdk_pixbuf_new_from_data(), useful
195// for language bindings.
196func NewPixbufFromBytes(DataVar *glib.Bytes, ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int, RowstrideVar int) *Pixbuf {
197	var cls *Pixbuf
198
199	cret := xNewPixbufFromBytes(DataVar, ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar, RowstrideVar)
200
201	if cret == 0 {
202		return nil
203	}
204	cls = &Pixbuf{}
205	cls.Ptr = cret
206	return cls
207}
208
209var xNewPixbufFromData func([]byte, Colorspace, bool, int, int, int, int, uintptr, uintptr) uintptr
210
211// Creates a new #GdkPixbuf out of in-memory image data.
212//
213// Currently only RGB images with 8 bits per sample are supported.
214//
215// Since you are providing a pre-allocated pixel buffer, you must also
216// specify a way to free that data.  This is done with a function of
217// type `GdkPixbufDestroyNotify`.  When a pixbuf created with is
218// finalized, your destroy notification function will be called, and
219// it is its responsibility to free the pixel array.
220//
221// See also: [ctor@GdkPixbuf.Pixbuf.new_from_bytes]
222func NewPixbufFromData(DataVar []byte, ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int, RowstrideVar int, DestroyFnVar *PixbufDestroyNotify, DestroyFnDataVar uintptr) *Pixbuf {
223	var cls *Pixbuf
224
225	var DestroyFnVarRef uintptr
226	if DestroyFnVar != nil {
227		DestroyFnVarPtr := uintptr(unsafe.Pointer(DestroyFnVar))
228		if cbRefPtr, ok := glib.GetCallback(DestroyFnVarPtr); ok {
229			DestroyFnVarRef = cbRefPtr
230		} else {
231			fcb := func(arg0 []byte, arg1 uintptr) {
232				cbFn := *DestroyFnVar
233				cbFn(arg0, arg1)
234			}
235			DestroyFnVarRef = purego.NewCallback(fcb)
236			glib.SaveCallbackWithClosure(DestroyFnVarPtr, DestroyFnVarRef, DestroyFnVar)
237		}
238	}
239
240	cret := xNewPixbufFromData(DataVar, ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar, RowstrideVar, DestroyFnVarRef, DestroyFnDataVar)
241
242	if cret == 0 {
243		return nil
244	}
245	cls = &Pixbuf{}
246	cls.Ptr = cret
247	return cls
248}
249
250var xNewPixbufFromFile func(string, **glib.Error) uintptr
251
252// Creates a new pixbuf by loading an image from a file.
253//
254// The file format is detected automatically.
255//
256// If `NULL` is returned, then @error will be set. Possible errors are:
257//
258//   - the file could not be opened
259//   - there is no loader for the file's format
260//   - there is not enough memory to allocate the image buffer
261//   - the image buffer contains invalid data
262//
263// The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
264func NewPixbufFromFile(FilenameVar string) (*Pixbuf, error) {
265	var cls *Pixbuf
266	var cerr *glib.Error
267
268	cret := xNewPixbufFromFile(FilenameVar, &cerr)
269
270	if cret == 0 {
271		return nil, cerr
272	}
273	cls = &Pixbuf{}
274	cls.Ptr = cret
275	if cerr == nil {
276		return cls, nil
277	}
278	return cls, cerr
279
280}
281
282var xNewPixbufFromFileAtScale func(string, int, int, bool, **glib.Error) uintptr
283
284// Creates a new pixbuf by loading an image from a file.
285//
286// The file format is detected automatically.
287//
288// If `NULL` is returned, then @error will be set. Possible errors are:
289//
290//   - the file could not be opened
291//   - there is no loader for the file's format
292//   - there is not enough memory to allocate the image buffer
293//   - the image buffer contains invalid data
294//
295// The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
296//
297// The image will be scaled to fit in the requested size, optionally preserving
298// the image's aspect ratio.
299//
300// When preserving the aspect ratio, a `width` of -1 will cause the image
301// to be scaled to the exact given height, and a `height` of -1 will cause
302// the image to be scaled to the exact given width. When not preserving
303// aspect ratio, a `width` or `height` of -1 means to not scale the image
304// at all in that dimension. Negative values for `width` and `height` are
305// allowed since 2.8.
306func NewPixbufFromFileAtScale(FilenameVar string, WidthVar int, HeightVar int, PreserveAspectRatioVar bool) (*Pixbuf, error) {
307	var cls *Pixbuf
308	var cerr *glib.Error
309
310	cret := xNewPixbufFromFileAtScale(FilenameVar, WidthVar, HeightVar, PreserveAspectRatioVar, &cerr)
311
312	if cret == 0 {
313		return nil, cerr
314	}
315	cls = &Pixbuf{}
316	cls.Ptr = cret
317	if cerr == nil {
318		return cls, nil
319	}
320	return cls, cerr
321
322}
323
324var xNewPixbufFromFileAtSize func(string, int, int, **glib.Error) uintptr
325
326// Creates a new pixbuf by loading an image from a file.
327//
328// The file format is detected automatically.
329//
330// If `NULL` is returned, then @error will be set. Possible errors are:
331//
332//   - the file could not be opened
333//   - there is no loader for the file's format
334//   - there is not enough memory to allocate the image buffer
335//   - the image buffer contains invalid data
336//
337// The error domains are `GDK_PIXBUF_ERROR` and `G_FILE_ERROR`.
338//
339// The image will be scaled to fit in the requested size, preserving
340// the image's aspect ratio. Note that the returned pixbuf may be smaller
341// than `width` x `height`, if the aspect ratio requires it. To load
342// and image at the requested size, regardless of aspect ratio, use
343// [ctor@GdkPixbuf.Pixbuf.new_from_file_at_scale].
344func NewPixbufFromFileAtSize(FilenameVar string, WidthVar int, HeightVar int) (*Pixbuf, error) {
345	var cls *Pixbuf
346	var cerr *glib.Error
347
348	cret := xNewPixbufFromFileAtSize(FilenameVar, WidthVar, HeightVar, &cerr)
349
350	if cret == 0 {
351		return nil, cerr
352	}
353	cls = &Pixbuf{}
354	cls.Ptr = cret
355	if cerr == nil {
356		return cls, nil
357	}
358	return cls, cerr
359
360}
361
362var xNewPixbufFromInline func(int, []byte, bool, **glib.Error) uintptr
363
364// Creates a `GdkPixbuf` from a flat representation that is suitable for
365// storing as inline data in a program.
366//
367// This is useful if you want to ship a program with images, but don't want
368// to depend on any external files.
369//
370// GdkPixbuf ships with a program called `gdk-pixbuf-csource`, which allows
371// for conversion of `GdkPixbuf`s into such a inline representation.
372//
373// In almost all cases, you should pass the `--raw` option to
374// `gdk-pixbuf-csource`. A sample invocation would be:
375//
376// ```
377// gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
378// ```
379//
380// For the typical case where the inline pixbuf is read-only static data,
381// you don't need to copy the pixel data unless you intend to write to
382// it, so you can pass `FALSE` for `copy_pixels`. If you pass `--rle` to
383// `gdk-pixbuf-csource`, a copy will be made even if `copy_pixels` is `FALSE`,
384// so using this option is generally a bad idea.
385//
386// If you create a pixbuf from const inline data compiled into your
387// program, it's probably safe to ignore errors and disable length checks,
388// since things will always succeed:
389//
390// ```c
391// pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
392// ```
393//
394// For non-const inline data, you could get out of memory. For untrusted
395// inline data located at runtime, you could have corrupt inline data in
396// addition.
397func NewPixbufFromInline(DataLengthVar int, DataVar []byte, CopyPixelsVar bool) (*Pixbuf, error) {
398	var cls *Pixbuf
399	var cerr *glib.Error
400
401	cret := xNewPixbufFromInline(DataLengthVar, DataVar, CopyPixelsVar, &cerr)
402
403	if cret == 0 {
404		return nil, cerr
405	}
406	cls = &Pixbuf{}
407	cls.Ptr = cret
408	if cerr == nil {
409		return cls, nil
410	}
411	return cls, cerr
412
413}
414
415var xNewPixbufFromResource func(string, **glib.Error) uintptr
416
417// Creates a new pixbuf by loading an image from an resource.
418//
419// The file format is detected automatically. If `NULL` is returned, then
420// @error will be set.
421func NewPixbufFromResource(ResourcePathVar string) (*Pixbuf, error) {
422	var cls *Pixbuf
423	var cerr *glib.Error
424
425	cret := xNewPixbufFromResource(ResourcePathVar, &cerr)
426
427	if cret == 0 {
428		return nil, cerr
429	}
430	cls = &Pixbuf{}
431	cls.Ptr = cret
432	if cerr == nil {
433		return cls, nil
434	}
435	return cls, cerr
436
437}
438
439var xNewPixbufFromResourceAtScale func(string, int, int, bool, **glib.Error) uintptr
440
441// Creates a new pixbuf by loading an image from an resource.
442//
443// The file format is detected automatically. If `NULL` is returned, then
444// @error will be set.
445//
446// The image will be scaled to fit in the requested size, optionally
447// preserving the image's aspect ratio. When preserving the aspect ratio,
448// a @width of -1 will cause the image to be scaled to the exact given
449// height, and a @height of -1 will cause the image to be scaled to the
450// exact given width. When not preserving aspect ratio, a @width or
451// @height of -1 means to not scale the image at all in that dimension.
452//
453// The stream is not closed.
454func NewPixbufFromResourceAtScale(ResourcePathVar string, WidthVar int, HeightVar int, PreserveAspectRatioVar bool) (*Pixbuf, error) {
455	var cls *Pixbuf
456	var cerr *glib.Error
457
458	cret := xNewPixbufFromResourceAtScale(ResourcePathVar, WidthVar, HeightVar, PreserveAspectRatioVar, &cerr)
459
460	if cret == 0 {
461		return nil, cerr
462	}
463	cls = &Pixbuf{}
464	cls.Ptr = cret
465	if cerr == nil {
466		return cls, nil
467	}
468	return cls, cerr
469
470}
471
472var xNewPixbufFromStream func(uintptr, uintptr, **glib.Error) uintptr
473
474// Creates a new pixbuf by loading an image from an input stream.
475//
476// The file format is detected automatically.
477//
478// If `NULL` is returned, then `error` will be set.
479//
480// The `cancellable` can be used to abort the operation from another thread.
481// If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be
482// returned. Other possible errors are in the `GDK_PIXBUF_ERROR` and
483// `G_IO_ERROR` domains.
484//
485// The stream is not closed.
486func NewPixbufFromStream(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable) (*Pixbuf, error) {
487	var cls *Pixbuf
488	var cerr *glib.Error
489
490	cret := xNewPixbufFromStream(StreamVar.GoPointer(), CancellableVar.GoPointer(), &cerr)
491
492	if cret == 0 {
493		return nil, cerr
494	}
495	cls = &Pixbuf{}
496	cls.Ptr = cret
497	if cerr == nil {
498		return cls, nil
499	}
500	return cls, cerr
501
502}
503
504var xNewPixbufFromStreamAtScale func(uintptr, int, int, bool, uintptr, **glib.Error) uintptr
505
506// Creates a new pixbuf by loading an image from an input stream.
507//
508// The file format is detected automatically. If `NULL` is returned, then
509// @error will be set. The @cancellable can be used to abort the operation
510// from another thread. If the operation was cancelled, the error
511// `G_IO_ERROR_CANCELLED` will be returned. Other possible errors are in
512// the `GDK_PIXBUF_ERROR` and `G_IO_ERROR` domains.
513//
514// The image will be scaled to fit in the requested size, optionally
515// preserving the image's aspect ratio.
516//
517// When preserving the aspect ratio, a `width` of -1 will cause the image to be
518// scaled to the exact given height, and a `height` of -1 will cause the image
519// to be scaled to the exact given width. If both `width` and `height` are
520// given, this function will behave as if the smaller of the two values
521// is passed as -1.
522//
523// When not preserving aspect ratio, a `width` or `height` of -1 means to not
524// scale the image at all in that dimension.
525//
526// The stream is not closed.
527func NewPixbufFromStreamAtScale(StreamVar *gio.InputStream, WidthVar int, HeightVar int, PreserveAspectRatioVar bool, CancellableVar *gio.Cancellable) (*Pixbuf, error) {
528	var cls *Pixbuf
529	var cerr *glib.Error
530
531	cret := xNewPixbufFromStreamAtScale(StreamVar.GoPointer(), WidthVar, HeightVar, PreserveAspectRatioVar, CancellableVar.GoPointer(), &cerr)
532
533	if cret == 0 {
534		return nil, cerr
535	}
536	cls = &Pixbuf{}
537	cls.Ptr = cret
538	if cerr == nil {
539		return cls, nil
540	}
541	return cls, cerr
542
543}
544
545var xNewPixbufFromStreamFinish func(uintptr, **glib.Error) uintptr
546
547// Finishes an asynchronous pixbuf creation operation started with
548// gdk_pixbuf_new_from_stream_async().
549func NewPixbufFromStreamFinish(AsyncResultVar gio.AsyncResult) (*Pixbuf, error) {
550	var cls *Pixbuf
551	var cerr *glib.Error
552
553	cret := xNewPixbufFromStreamFinish(AsyncResultVar.GoPointer(), &cerr)
554
555	if cret == 0 {
556		return nil, cerr
557	}
558	cls = &Pixbuf{}
559	cls.Ptr = cret
560	if cerr == nil {
561		return cls, nil
562	}
563	return cls, cerr
564
565}
566
567var xNewPixbufFromXpmData func([]string) uintptr
568
569// Creates a new pixbuf by parsing XPM data in memory.
570//
571// This data is commonly the result of including an XPM file into a
572// program's C source.
573func NewPixbufFromXpmData(DataVar []string) *Pixbuf {
574	var cls *Pixbuf
575
576	cret := xNewPixbufFromXpmData(DataVar)
577
578	if cret == 0 {
579		return nil
580	}
581	cls = &Pixbuf{}
582	cls.Ptr = cret
583	return cls
584}
585
586var xPixbufAddAlpha func(uintptr, bool, byte, byte, byte) uintptr
587
588// Takes an existing pixbuf and adds an alpha channel to it.
589//
590// If the existing pixbuf already had an alpha channel, the channel
591// values are copied from the original; otherwise, the alpha channel
592// is initialized to 255 (full opacity).
593//
594// If `substitute_color` is `TRUE`, then the color specified by the
595// (`r`, `g`, `b`) arguments will be assigned zero opacity. That is,
596// if you pass `(255, 255, 255)` for the substitute color, all white
597// pixels will become fully transparent.
598//
599// If `substitute_color` is `FALSE`, then the (`r`, `g`, `b`) arguments
600// will be ignored.
601func (x *Pixbuf) AddAlpha(SubstituteColorVar bool, RVar byte, GVar byte, BVar byte) *Pixbuf {
602	var cls *Pixbuf
603
604	cret := xPixbufAddAlpha(x.GoPointer(), SubstituteColorVar, RVar, GVar, BVar)
605
606	if cret == 0 {
607		return nil
608	}
609	cls = &Pixbuf{}
610	cls.Ptr = cret
611	return cls
612}
613
614var xPixbufApplyEmbeddedOrientation func(uintptr) uintptr
615
616// Takes an existing pixbuf and checks for the presence of an
617// associated "orientation" option.
618//
619// The orientation option may be provided by the JPEG loader (which
620// reads the exif orientation tag) or the TIFF loader (which reads
621// the TIFF orientation tag, and compensates it for the partial
622// transforms performed by libtiff).
623//
624// If an orientation option/tag is present, the appropriate transform
625// will be performed so that the pixbuf is oriented correctly.
626func (x *Pixbuf) ApplyEmbeddedOrientation() *Pixbuf {
627	var cls *Pixbuf
628
629	cret := xPixbufApplyEmbeddedOrientation(x.GoPointer())
630
631	if cret == 0 {
632		return nil
633	}
634	cls = &Pixbuf{}
635	cls.Ptr = cret
636	return cls
637}
638
639var xPixbufComposite func(uintptr, uintptr, int, int, int, int, float64, float64, float64, float64, InterpType, int)
640
641// Creates a transformation of the source image @src by scaling by
642// @scale_x and @scale_y then translating by @offset_x and @offset_y.
643//
644// This gives an image in the coordinates of the destination pixbuf.
645// The rectangle (@dest_x, @dest_y, @dest_width, @dest_height)
646// is then alpha blended onto the corresponding rectangle of the
647// original destination image.
648//
649// When the destination rectangle contains parts not in the source
650// image, the data at the edges of the source image is replicated
651// to infinity.
652//
653// ![](composite.png)
654func (x *Pixbuf) Composite(DestVar *Pixbuf, DestXVar int, DestYVar int, DestWidthVar int, DestHeightVar int, OffsetXVar float64, OffsetYVar float64, ScaleXVar float64, ScaleYVar float64, InterpTypeVar InterpType, OverallAlphaVar int) {
655
656	xPixbufComposite(x.GoPointer(), DestVar.GoPointer(), DestXVar, DestYVar, DestWidthVar, DestHeightVar, OffsetXVar, OffsetYVar, ScaleXVar, ScaleYVar, InterpTypeVar, OverallAlphaVar)
657
658}
659
660var xPixbufCompositeColor func(uintptr, uintptr, int, int, int, int, float64, float64, float64, float64, InterpType, int, int, int, int, uint32, uint32)
661
662// Creates a transformation of the source image @src by scaling by
663// @scale_x and @scale_y then translating by @offset_x and @offset_y,
664// then alpha blends the rectangle (@dest_x ,@dest_y, @dest_width,
665// @dest_height) of the resulting image with a checkboard of the
666// colors @color1 and @color2 and renders it onto the destination
667// image.
668//
669// If the source image has no alpha channel, and @overall_alpha is 255, a fast
670// path is used which omits the alpha blending and just performs the scaling.
671//
672// See gdk_pixbuf_composite_color_simple() for a simpler variant of this
673// function suitable for many tasks.
674func (x *Pixbuf) CompositeColor(DestVar *Pixbuf, DestXVar int, DestYVar int, DestWidthVar int, DestHeightVar int, OffsetXVar float64, OffsetYVar float64, ScaleXVar float64, ScaleYVar float64, InterpTypeVar InterpType, OverallAlphaVar int, CheckXVar int, CheckYVar int, CheckSizeVar int, Color1Var uint32, Color2Var uint32) {
675
676	xPixbufCompositeColor(x.GoPointer(), DestVar.GoPointer(), DestXVar, DestYVar, DestWidthVar, DestHeightVar, OffsetXVar, OffsetYVar, ScaleXVar, ScaleYVar, InterpTypeVar, OverallAlphaVar, CheckXVar, CheckYVar, CheckSizeVar, Color1Var, Color2Var)
677
678}
679
680var xPixbufCompositeColorSimple func(uintptr, int, int, InterpType, int, int, uint32, uint32) uintptr
681
682// Creates a new pixbuf by scaling `src` to `dest_width` x `dest_height`
683// and alpha blending the result with a checkboard of colors `color1`
684// and `color2`.
685func (x *Pixbuf) CompositeColorSimple(DestWidthVar int, DestHeightVar int, InterpTypeVar InterpType, OverallAlphaVar int, CheckSizeVar int, Color1Var uint32, Color2Var uint32) *Pixbuf {
686	var cls *Pixbuf
687
688	cret := xPixbufCompositeColorSimple(x.GoPointer(), DestWidthVar, DestHeightVar, InterpTypeVar, OverallAlphaVar, CheckSizeVar, Color1Var, Color2Var)
689
690	if cret == 0 {
691		return nil
692	}
693	cls = &Pixbuf{}
694	cls.Ptr = cret
695	return cls
696}
697
698var xPixbufCopy func(uintptr) uintptr
699
700// Creates a new `GdkPixbuf` with a copy of the information in the specified
701// `pixbuf`.
702//
703// Note that this does not copy the options set on the original `GdkPixbuf`,
704// use gdk_pixbuf_copy_options() for this.
705func (x *Pixbuf) Copy() *Pixbuf {
706	var cls *Pixbuf
707
708	cret := xPixbufCopy(x.GoPointer())
709
710	if cret == 0 {
711		return nil
712	}
713	cls = &Pixbuf{}
714	cls.Ptr = cret
715	return cls
716}
717
718var xPixbufCopyArea func(uintptr, int, int, int, int, uintptr, int, int)
719
720// Copies a rectangular area from `src_pixbuf` to `dest_pixbuf`.
721//
722// Conversion of pixbuf formats is done automatically.
723//
724// If the source rectangle overlaps the destination rectangle on the
725// same pixbuf, it will be overwritten during the copy operation.
726// Therefore, you can not use this function to scroll a pixbuf.
727func (x *Pixbuf) CopyArea(SrcXVar int, SrcYVar int, WidthVar int, HeightVar int, DestPixbufVar *Pixbuf, DestXVar int, DestYVar int) {
728
729	xPixbufCopyArea(x.GoPointer(), SrcXVar, SrcYVar, WidthVar, HeightVar, DestPixbufVar.GoPointer(), DestXVar, DestYVar)
730
731}
732
733var xPixbufCopyOptions func(uintptr, uintptr) bool
734
735// Copies the key/value pair options attached to a `GdkPixbuf` to another
736// `GdkPixbuf`.
737//
738// This is useful to keep original metadata after having manipulated
739// a file. However be careful to remove metadata which you've already
740// applied, such as the "orientation" option after rotating the image.
741func (x *Pixbuf) CopyOptions(DestPixbufVar *Pixbuf) bool {
742
743	cret := xPixbufCopyOptions(x.GoPointer(), DestPixbufVar.GoPointer())
744	return cret
745}
746
747var xPixbufFill func(uintptr, uint32)
748
749// Clears a pixbuf to the given RGBA value, converting the RGBA value into
750// the pixbuf's pixel format.
751//
752// The alpha component will be ignored if the pixbuf doesn't have an alpha
753// channel.
754func (x *Pixbuf) Fill(PixelVar uint32) {
755
756	xPixbufFill(x.GoPointer(), PixelVar)
757
758}
759
760var xPixbufFlip func(uintptr, bool) uintptr
761
762// Flips a pixbuf horizontally or vertically and returns the
763// result in a new pixbuf.
764func (x *Pixbuf) Flip(HorizontalVar bool) *Pixbuf {
765	var cls *Pixbuf
766
767	cret := xPixbufFlip(x.GoPointer(), HorizontalVar)
768
769	if cret == 0 {
770		return nil
771	}
772	cls = &Pixbuf{}
773	cls.Ptr = cret
774	return cls
775}
776
777var xPixbufGetBitsPerSample func(uintptr) int
778
779// Queries the number of bits per color sample in a pixbuf.
780func (x *Pixbuf) GetBitsPerSample() int {
781
782	cret := xPixbufGetBitsPerSample(x.GoPointer())
783	return cret
784}
785
786var xPixbufGetByteLength func(uintptr) uint
787
788// Returns the length of the pixel data, in bytes.
789func (x *Pixbuf) GetByteLength() uint {
790
791	cret := xPixbufGetByteLength(x.GoPointer())
792	return cret
793}
794
795var xPixbufGetColorspace func(uintptr) Colorspace
796
797// Queries the color space of a pixbuf.
798func (x *Pixbuf) GetColorspace() Colorspace {
799
800	cret := xPixbufGetColorspace(x.GoPointer())
801	return cret
802}
803
804var xPixbufGetHasAlpha func(uintptr) bool
805
806// Queries whether a pixbuf has an alpha channel (opacity information).
807func (x *Pixbuf) GetHasAlpha() bool {
808
809	cret := xPixbufGetHasAlpha(x.GoPointer())
810	return cret
811}
812
813var xPixbufGetHeight func(uintptr) int
814
815// Queries the height of a pixbuf.
816func (x *Pixbuf) GetHeight() int {
817
818	cret := xPixbufGetHeight(x.GoPointer())
819	return cret
820}
821
822var xPixbufGetNChannels func(uintptr) int
823
824// Queries the number of channels of a pixbuf.
825func (x *Pixbuf) GetNChannels() int {
826
827	cret := xPixbufGetNChannels(x.GoPointer())
828	return cret
829}
830
831var xPixbufGetOption func(uintptr, string) string
832
833// Looks up @key in the list of options that may have been attached to the
834// @pixbuf when it was loaded, or that may have been attached by another
835// function using gdk_pixbuf_set_option().
836//
837// For instance, the ANI loader provides "Title" and "Artist" options.
838// The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
839// options for cursor definitions. The PNG loader provides the tEXt ancillary
840// chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
841// return an "orientation" option string that corresponds to the embedded
842// TIFF/Exif orientation tag (if present). Since 2.32, the TIFF loader sets
843// the "multipage" option string to "yes" when a multi-page TIFF is loaded.
844// Since 2.32 the JPEG and PNG loaders set "x-dpi" and "y-dpi" if the file
845// contains image density information in dots per inch.
846// Since 2.36.6, the JPEG loader sets the "comment" option with the comment
847// EXIF tag.
848func (x *Pixbuf) GetOption(KeyVar string) string {
849
850	cret := xPixbufGetOption(x.GoPointer(), KeyVar)
851	return cret
852}
853
854var xPixbufGetOptions func(uintptr) *glib.HashTable
855
856// Returns a `GHashTable` with a list of all the options that may have been
857// attached to the `pixbuf` when it was loaded, or that may have been
858// attached by another function using [method@GdkPixbuf.Pixbuf.set_option].
859func (x *Pixbuf) GetOptions() *glib.HashTable {
860
861	cret := xPixbufGetOptions(x.GoPointer())
862	return cret
863}
864
865var xPixbufGetPixels func(uintptr) uintptr
866
867// Queries a pointer to the pixel data of a pixbuf.
868//
869// This function will cause an implicit copy of the pixbuf data if the
870// pixbuf was created from read-only data.
871//
872// Please see the section on [image data](class.Pixbuf.html#image-data) for information
873// about how the pixel data is stored in memory.
874func (x *Pixbuf) GetPixels() uintptr {
875
876	cret := xPixbufGetPixels(x.GoPointer())
877	return cret
878}
879
880var xPixbufGetPixelsWithLength func(uintptr, *uint) uintptr
881
882// Queries a pointer to the pixel data of a pixbuf.
883//
884// This function will cause an implicit copy of the pixbuf data if the
885// pixbuf was created from read-only data.
886//
887// Please see the section on [image data](class.Pixbuf.html#image-data) for information
888// about how the pixel data is stored in memory.
889func (x *Pixbuf) GetPixelsWithLength(LengthVar *uint) uintptr {
890
891	cret := xPixbufGetPixelsWithLength(x.GoPointer(), LengthVar)
892	return cret
893}
894
895var xPixbufGetRowstride func(uintptr) int
896
897// Queries the rowstride of a pixbuf, which is the number of bytes between
898// the start of a row and the start of the next row.
899func (x *Pixbuf) GetRowstride() int {
900
901	cret := xPixbufGetRowstride(x.GoPointer())
902	return cret
903}
904
905var xPixbufGetWidth func(uintptr) int
906
907// Queries the width of a pixbuf.
908func (x *Pixbuf) GetWidth() int {
909
910	cret := xPixbufGetWidth(x.GoPointer())
911	return cret
912}
913
914var xPixbufNewSubpixbuf func(uintptr, int, int, int, int) uintptr
915
916// Creates a new pixbuf which represents a sub-region of `src_pixbuf`.
917//
918// The new pixbuf shares its pixels with the original pixbuf, so
919// writing to one affects both.  The new pixbuf holds a reference to
920// `src_pixbuf`, so `src_pixbuf` will not be finalized until the new
921// pixbuf is finalized.
922//
923// Note that if `src_pixbuf` is read-only, this function will force it
924// to be mutable.
925func (x *Pixbuf) NewSubpixbuf(SrcXVar int, SrcYVar int, WidthVar int, HeightVar int) *Pixbuf {
926	var cls *Pixbuf
927
928	cret := xPixbufNewSubpixbuf(x.GoPointer(), SrcXVar, SrcYVar, WidthVar, HeightVar)
929
930	if cret == 0 {
931		return nil
932	}
933	cls = &Pixbuf{}
934	cls.Ptr = cret
935	return cls
936}
937
938var xPixbufReadPixelBytes func(uintptr) *glib.Bytes
939
940// Provides a #GBytes buffer containing the raw pixel data; the data
941// must not be modified.
942//
943// This function allows skipping the implicit copy that must be made
944// if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.
945func (x *Pixbuf) ReadPixelBytes() *glib.Bytes {
946
947	cret := xPixbufReadPixelBytes(x.GoPointer())
948	return cret
949}
950
951var xPixbufReadPixels func(uintptr) byte
952
953// Provides a read-only pointer to the raw pixel data.
954//
955// This function allows skipping the implicit copy that must be made
956// if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.
957func (x *Pixbuf) ReadPixels() byte {
958
959	cret := xPixbufReadPixels(x.GoPointer())
960	return cret
961}
962
963var xPixbufRef func(uintptr) uintptr
964
965// Adds a reference to a pixbuf.
966func (x *Pixbuf) Ref() *Pixbuf {
967	var cls *Pixbuf
968
969	cret := xPixbufRef(x.GoPointer())
970
971	if cret == 0 {
972		return nil
973	}
974	cls = &Pixbuf{}
975	cls.Ptr = cret
976	return cls
977}
978
979var xPixbufRemoveOption func(uintptr, string) bool
980
981// Removes the key/value pair option attached to a `GdkPixbuf`.
982func (x *Pixbuf) RemoveOption(KeyVar string) bool {
983
984	cret := xPixbufRemoveOption(x.GoPointer(), KeyVar)
985	return cret
986}
987
988var xPixbufRotateSimple func(uintptr, PixbufRotation) uintptr
989
990// Rotates a pixbuf by a multiple of 90 degrees, and returns the
991// result in a new pixbuf.
992//
993// If `angle` is 0, this function will return a copy of `src`.
994func (x *Pixbuf) RotateSimple(AngleVar PixbufRotation) *Pixbuf {
995	var cls *Pixbuf
996
997	cret := xPixbufRotateSimple(x.GoPointer(), AngleVar)
998
999	if cret == 0 {
1000		return nil
1001	}
1002	cls = &Pixbuf{}
1003	cls.Ptr = cret
1004	return cls
1005}
1006
1007var xPixbufSaturateAndPixelate func(uintptr, uintptr, float32, bool)
1008
1009// Modifies saturation and optionally pixelates `src`, placing the result in
1010// `dest`.
1011//
1012// The `src` and `dest` pixbufs must have the same image format, size, and
1013// rowstride.
1014//
1015// The `src` and `dest` arguments may be the same pixbuf with no ill effects.
1016//
1017// If `saturation` is 1.0 then saturation is not changed. If it's less than 1.0,
1018// saturation is reduced (the image turns toward grayscale); if greater than
1019// 1.0, saturation is increased (the image gets more vivid colors).
1020//
1021// If `pixelate` is `TRUE`, then pixels are faded in a checkerboard pattern to
1022// create a pixelated image.
1023func (x *Pixbuf) SaturateAndPixelate(DestVar *Pixbuf, SaturationVar float32, PixelateVar bool) {
1024
1025	xPixbufSaturateAndPixelate(x.GoPointer(), DestVar.GoPointer(), SaturationVar, PixelateVar)
1026
1027}
1028
1029var xPixbufSave func(uintptr, string, string, **glib.Error, ...interface{}) bool
1030
1031// Saves pixbuf to a file in format @type. By default, "jpeg", "png", "ico"
1032// and "bmp" are possible file formats to save in, but more formats may be
1033// installed. The list of all writable formats can be determined in the
1034// following way:
1035//
1036// ```c
1037// void add_if_writable (GdkPixbufFormat *data, GSList **list)
1038//
1039//	{
1040//	  if (gdk_pixbuf_format_is_writable (data))
1041//	    *list = g_slist_prepend (*list, data);
1042//	}
1043//
1044// GSList *formats = gdk_pixbuf_get_formats ();
1045// GSList *writable_formats = NULL;
1046// g_slist_foreach (formats, add_if_writable, &writable_formats);
1047// g_slist_free (formats);
1048// ```
1049//
1050// If `error` is set, `FALSE` will be returned. Possible errors include
1051// those in the `GDK_PIXBUF_ERROR` domain and those in the `G_FILE_ERROR`
1052// domain.
1053//
1054// The variable argument list should be `NULL`-terminated; if not empty,
1055// it should contain pairs of strings that modify the save
1056// parameters. For example:
1057//
1058// ```c
1059// gdk_pixbuf_save (pixbuf, handle, "jpeg", &error, "quality", "100", NULL);
1060// ```
1061//
1062// Currently only few parameters exist.
1063//
1064// JPEG images can be saved with a "quality" parameter; its value should be
1065// in the range `[0, 100]`. JPEG and PNG density can be set by setting the
1066// "x-dpi" and "y-dpi" parameters to the appropriate values in dots per inch.
1067//
1068// Text chunks can be attached to PNG images by specifying parameters of
1069// the form "tEXt::key", where key is an ASCII string of length 1-79.
1070// The values are UTF-8 encoded strings. The PNG compression level can
1071// be specified using the "compression" parameter; it's value is in an
1072// integer in the range of `[0, 9]`.
1073//
1074// ICC color profiles can also be embedded into PNG, JPEG and TIFF images.
1075// The "icc-profile" value should be the complete ICC profile encoded
1076// into base64.
1077//
1078// ```c
1079// char *contents;
1080// gsize length;
1081//
1082// // icm_path is set elsewhere
1083// g_file_get_contents (icm_path, &contents, &length, NULL);
1084//
1085// char *contents_encode = g_base64_encode ((const guchar *) contents, length);
1086//
1087// gdk_pixbuf_save (pixbuf, handle, "png", &error, "icc-profile", contents_encode, NULL);
1088// ```
1089//
1090// TIFF images recognize:
1091//
1092//  1. a "bits-per-sample" option (integer) which can be either 1 for saving
1093//     bi-level CCITTFAX4 images, or 8 for saving 8-bits per sample
1094//  2. a "compression" option (integer) which can be 1 for no compression,
1095//     2 for Huffman, 5 for LZW, 7 for JPEG and 8 for DEFLATE (see the libtiff
1096//     documentation and tiff.h for all supported codec values)
1097//  3. an "icc-profile" option (zero-terminated string) containing a base64
1098//     encoded ICC color profile.
1099//
1100// ICO images can be saved in depth 16, 24, or 32, by using the "depth"
1101// parameter. When the ICO saver is given "x_hot" and "y_hot" parameters,
1102// it produces a CUR instead of an ICO.
1103func (x *Pixbuf) Save(FilenameVar string, TypeVar string, ErrorVar **glib.Error, varArgs ...interface{}) bool {
1104
1105	cret := xPixbufSave(x.GoPointer(), FilenameVar, TypeVar, ErrorVar, varArgs...)
1106	return cret
1107}
1108
1109var xPixbufSaveToBuffer func(uintptr, *[]byte, *uint, string, **glib.Error, ...interface{}) bool
1110
1111// Saves pixbuf to a new buffer in format `type`, which is currently "jpeg",
1112// "png", "tiff", "ico" or "bmp".
1113//
1114// This is a convenience function that uses `gdk_pixbuf_save_to_callback()`
1115// to do the real work.
1116//
1117// Note that the buffer is not `NUL`-terminated and may contain embedded `NUL`
1118// characters.
1119//
1120// If @error is set, `FALSE` will be returned and @buffer will be set to
1121// `NULL`. Possible errors include those in the `GDK_PIXBUF_ERROR`
1122// domain.
1123//
1124// See `gdk_pixbuf_save()` for more details.
1125func (x *Pixbuf) SaveToBuffer(BufferVar *[]byte, BufferSizeVar *uint, TypeVar string, ErrorVar **glib.Error, varArgs ...interface{}) bool {
1126
1127	cret := xPixbufSaveToBuffer(x.GoPointer(), BufferVar, BufferSizeVar, TypeVar, ErrorVar, varArgs...)
1128	return cret
1129}
1130
1131var xPixbufSaveToBufferv func(uintptr, *[]byte, *uint, string, []string, []string, **glib.Error) bool
1132
1133// Vector version of `gdk_pixbuf_save_to_buffer()`.
1134//
1135// Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
1136// "tiff", "png", "ico" or "bmp".
1137//
1138// See [method@GdkPixbuf.Pixbuf.save_to_buffer] for more details.
1139func (x *Pixbuf) SaveToBufferv(BufferVar *[]byte, BufferSizeVar *uint, TypeVar string, OptionKeysVar []string, OptionValuesVar []string) (bool, error) {
1140	var cerr *glib.Error
1141
1142	cret := xPixbufSaveToBufferv(x.GoPointer(), BufferVar, BufferSizeVar, TypeVar, OptionKeysVar, OptionValuesVar, &cerr)
1143	if cerr == nil {
1144		return cret, nil
1145	}
1146	return cret, cerr
1147
1148}
1149
1150var xPixbufSaveToCallback func(uintptr, uintptr, uintptr, string, **glib.Error, ...interface{}) bool
1151
1152// Saves pixbuf in format `type` by feeding the produced data to a
1153// callback.
1154//
1155// This function can be used when you want to store the image to something
1156// other than a file, such as an in-memory buffer or a socket.
1157//
1158// If @error is set, `FALSE` will be returned. Possible errors
1159// include those in the `GDK_PIXBUF_ERROR` domain and whatever the save
1160// function generates.
1161//
1162// See [method@GdkPixbuf.Pixbuf.save] for more details.
1163func (x *Pixbuf) SaveToCallback(SaveFuncVar *PixbufSaveFunc, UserDataVar uintptr, TypeVar string, ErrorVar **glib.Error, varArgs ...interface{}) bool {
1164
1165	var SaveFuncVarRef uintptr
1166	if SaveFuncVar != nil {
1167		SaveFuncVarPtr := uintptr(unsafe.Pointer(SaveFuncVar))
1168		if cbRefPtr, ok := glib.GetCallback(SaveFuncVarPtr); ok {
1169			SaveFuncVarRef = cbRefPtr
1170		} else {
1171			fcb := func(arg0 []byte, arg1 uint, arg2 **glib.Error, arg3 uintptr) bool {
1172				cbFn := *SaveFuncVar
1173				return cbFn(arg0, arg1, arg2, arg3)
1174			}
1175			SaveFuncVarRef = purego.NewCallback(fcb)
1176			glib.SaveCallbackWithClosure(SaveFuncVarPtr, SaveFuncVarRef, SaveFuncVar)
1177		}
1178	}
1179
1180	cret := xPixbufSaveToCallback(x.GoPointer(), SaveFuncVarRef, UserDataVar, TypeVar, ErrorVar, varArgs...)
1181	return cret
1182}
1183
1184var xPixbufSaveToCallbackv func(uintptr, uintptr, uintptr, string, []string, []string, **glib.Error) bool
1185
1186// Vector version of `gdk_pixbuf_save_to_callback()`.
1187//
1188// Saves pixbuf to a callback in format @type, which is currently "jpeg",
1189// "png", "tiff", "ico" or "bmp".
1190//
1191// If @error is set, `FALSE` will be returned.
1192//
1193// See [method@GdkPixbuf.Pixbuf.save_to_callback] for more details.
1194func (x *Pixbuf) SaveToCallbackv(SaveFuncVar *PixbufSaveFunc, UserDataVar uintptr, TypeVar string, OptionKeysVar []string, OptionValuesVar []string) (bool, error) {
1195	var cerr *glib.Error
1196
1197	var SaveFuncVarRef uintptr
1198	if SaveFuncVar != nil {
1199		SaveFuncVarPtr := uintptr(unsafe.Pointer(SaveFuncVar))
1200		if cbRefPtr, ok := glib.GetCallback(SaveFuncVarPtr); ok {
1201			SaveFuncVarRef = cbRefPtr
1202		} else {
1203			fcb := func(arg0 []byte, arg1 uint, arg2 **glib.Error, arg3 uintptr) bool {
1204				cbFn := *SaveFuncVar
1205				return cbFn(arg0, arg1, arg2, arg3)
1206			}
1207			SaveFuncVarRef = purego.NewCallback(fcb)
1208			glib.SaveCallbackWithClosure(SaveFuncVarPtr, SaveFuncVarRef, SaveFuncVar)
1209		}
1210	}
1211
1212	cret := xPixbufSaveToCallbackv(x.GoPointer(), SaveFuncVarRef, UserDataVar, TypeVar, OptionKeysVar, OptionValuesVar, &cerr)
1213	if cerr == nil {
1214		return cret, nil
1215	}
1216	return cret, cerr
1217
1218}
1219
1220var xPixbufSaveToStream func(uintptr, uintptr, string, uintptr, **glib.Error, ...interface{}) bool
1221
1222// Saves `pixbuf` to an output stream.
1223//
1224// Supported file formats are currently "jpeg", "tiff", "png", "ico" or
1225// "bmp". See `gdk_pixbuf_save_to_buffer()` for more details.
1226//
1227// The `cancellable` can be used to abort the operation from another
1228// thread. If the operation was cancelled, the error `G_IO_ERROR_CANCELLED`
1229// will be returned. Other possible errors are in the `GDK_PIXBUF_ERROR`
1230// and `G_IO_ERROR` domains.
1231//
1232// The stream is not closed at the end of this call.
1233func (x *Pixbuf) SaveToStream(StreamVar *gio.OutputStream, TypeVar string, CancellableVar *gio.Cancellable, ErrorVar **glib.Error, varArgs ...interface{}) bool {
1234
1235	cret := xPixbufSaveToStream(x.GoPointer(), StreamVar.GoPointer(), TypeVar, CancellableVar.GoPointer(), ErrorVar, varArgs...)
1236	return cret
1237}
1238
1239var xPixbufSaveToStreamAsync func(uintptr, uintptr, string, uintptr, uintptr, uintptr, ...interface{})
1240
1241// Saves `pixbuf` to an output stream asynchronously.
1242//
1243// For more details see gdk_pixbuf_save_to_stream(), which is the synchronous
1244// version of this function.
1245//
1246// When the operation is finished, `callback` will be called in the main thread.
1247//
1248// You can then call gdk_pixbuf_save_to_stream_finish() to get the result of
1249// the operation.
1250func (x *Pixbuf) SaveToStreamAsync(StreamVar *gio.OutputStream, TypeVar string, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr, varArgs ...interface{}) {
1251
1252	var CallbackVarRef uintptr
1253	if CallbackVar != nil {
1254		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1255		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1256			CallbackVarRef = cbRefPtr
1257		} else {
1258			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1259				cbFn := *CallbackVar
1260				cbFn(arg0, arg1, arg2)
1261			}
1262			CallbackVarRef = purego.NewCallback(fcb)
1263			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1264		}
1265	}
1266
1267	xPixbufSaveToStreamAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar, varArgs...)
1268
1269}
1270
1271var xPixbufSaveToStreamv func(uintptr, uintptr, string, []string, []string, uintptr, **glib.Error) bool
1272
1273// Saves `pixbuf` to an output stream.
1274//
1275// Supported file formats are currently "jpeg", "tiff", "png", "ico" or
1276// "bmp".
1277//
1278// See [method@GdkPixbuf.Pixbuf.save_to_stream] for more details.
1279func (x *Pixbuf) SaveToStreamv(StreamVar *gio.OutputStream, TypeVar string, OptionKeysVar []string, OptionValuesVar []string, CancellableVar *gio.Cancellable) (bool, error) {
1280	var cerr *glib.Error
1281
1282	cret := xPixbufSaveToStreamv(x.GoPointer(), StreamVar.GoPointer(), TypeVar, OptionKeysVar, OptionValuesVar, CancellableVar.GoPointer(), &cerr)
1283	if cerr == nil {
1284		return cret, nil
1285	}
1286	return cret, cerr
1287
1288}
1289
1290var xPixbufSaveToStreamvAsync func(uintptr, uintptr, string, []string, []string, uintptr, uintptr, uintptr)
1291
1292// Saves `pixbuf` to an output stream asynchronously.
1293//
1294// For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous
1295// version of this function.
1296//
1297// When the operation is finished, `callback` will be called in the main thread.
1298//
1299// You can then call gdk_pixbuf_save_to_stream_finish() to get the result of
1300// the operation.
1301func (x *Pixbuf) SaveToStreamvAsync(StreamVar *gio.OutputStream, TypeVar string, OptionKeysVar []string, OptionValuesVar []string, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
1302
1303	var CallbackVarRef uintptr
1304	if CallbackVar != nil {
1305		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1306		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1307			CallbackVarRef = cbRefPtr
1308		} else {
1309			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1310				cbFn := *CallbackVar
1311				cbFn(arg0, arg1, arg2)
1312			}
1313			CallbackVarRef = purego.NewCallback(fcb)
1314			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1315		}
1316	}
1317
1318	xPixbufSaveToStreamvAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, OptionKeysVar, OptionValuesVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1319
1320}
1321
1322var xPixbufSavev func(uintptr, string, string, []string, []string, **glib.Error) bool
1323
1324// Vector version of `gdk_pixbuf_save()`.
1325//
1326// Saves pixbuf to a file in `type`, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
1327//
1328// If @error is set, `FALSE` will be returned.
1329//
1330// See [method@GdkPixbuf.Pixbuf.save] for more details.
1331func (x *Pixbuf) Savev(FilenameVar string, TypeVar string, OptionKeysVar []string, OptionValuesVar []string) (bool, error) {
1332	var cerr *glib.Error
1333
1334	cret := xPixbufSavev(x.GoPointer(), FilenameVar, TypeVar, OptionKeysVar, OptionValuesVar, &cerr)
1335	if cerr == nil {
1336		return cret, nil
1337	}
1338	return cret, cerr
1339
1340}
1341
1342var xPixbufScale func(uintptr, uintptr, int, int, int, int, float64, float64, float64, float64, InterpType)
1343
1344// Creates a transformation of the source image @src by scaling by
1345// @scale_x and @scale_y then translating by @offset_x and @offset_y,
1346// then renders the rectangle (@dest_x, @dest_y, @dest_width,
1347// @dest_height) of the resulting image onto the destination image
1348// replacing the previous contents.
1349//
1350// Try to use gdk_pixbuf_scale_simple() first; this function is
1351// the industrial-strength power tool you can fall back to, if
1352// gdk_pixbuf_scale_simple() isn't powerful enough.
1353//
1354// If the source rectangle overlaps the destination rectangle on the
1355// same pixbuf, it will be overwritten during the scaling which
1356// results in rendering artifacts.
1357func (x *Pixbuf) Scale(DestVar *Pixbuf, DestXVar int, DestYVar int, DestWidthVar int, DestHeightVar int, OffsetXVar float64, OffsetYVar float64, ScaleXVar float64, ScaleYVar float64, InterpTypeVar InterpType) {
1358
1359	xPixbufScale(x.GoPointer(), DestVar.GoPointer(), DestXVar, DestYVar, DestWidthVar, DestHeightVar, OffsetXVar, OffsetYVar, ScaleXVar, ScaleYVar, InterpTypeVar)
1360
1361}
1362
1363var xPixbufScaleSimple func(uintptr, int, int, InterpType) uintptr
1364
1365// Create a new pixbuf containing a copy of `src` scaled to
1366// `dest_width` x `dest_height`.
1367//
1368// This function leaves `src` unaffected.
1369//
1370// The `interp_type` should be `GDK_INTERP_NEAREST` if you want maximum
1371// speed (but when scaling down `GDK_INTERP_NEAREST` is usually unusably
1372// ugly). The default `interp_type` should be `GDK_INTERP_BILINEAR` which
1373// offers reasonable quality and speed.
1374//
1375// You can scale a sub-portion of `src` by creating a sub-pixbuf
1376// pointing into `src`; see [method@GdkPixbuf.Pixbuf.new_subpixbuf].
1377//
1378// If `dest_width` and `dest_height` are equal to the width and height of
1379// `src`, this function will return an unscaled copy of `src`.
1380//
1381// For more complicated scaling/alpha blending see [method@GdkPixbuf.Pixbuf.scale]
1382// and [method@GdkPixbuf.Pixbuf.composite].
1383func (x *Pixbuf) ScaleSimple(DestWidthVar int, DestHeightVar int, InterpTypeVar InterpType) *Pixbuf {
1384	var cls *Pixbuf
1385
1386	cret := xPixbufScaleSimple(x.GoPointer(), DestWidthVar, DestHeightVar, InterpTypeVar)
1387
1388	if cret == 0 {
1389		return nil
1390	}
1391	cls = &Pixbuf{}
1392	cls.Ptr = cret
1393	return cls
1394}
1395
1396var xPixbufSetOption func(uintptr, string, string) bool
1397
1398// Attaches a key/value pair as an option to a `GdkPixbuf`.
1399//
1400// If `key` already exists in the list of options attached to the `pixbuf`,
1401// the new value is ignored and `FALSE` is returned.
1402func (x *Pixbuf) SetOption(KeyVar string, ValueVar string) bool {
1403
1404	cret := xPixbufSetOption(x.GoPointer(), KeyVar, ValueVar)
1405	return cret
1406}
1407
1408var xPixbufUnref func(uintptr)
1409
1410// Removes a reference from a pixbuf.
1411func (x *Pixbuf) Unref() {
1412
1413	xPixbufUnref(x.GoPointer())
1414
1415}
1416
1417func (c *Pixbuf) GoPointer() uintptr {
1418	if c == nil {
1419		return 0
1420	}
1421	return c.Ptr
1422}
1423
1424func (c *Pixbuf) SetGoPointer(ptr uintptr) {
1425	c.Ptr = ptr
1426}
1427
1428// SetPropertyBitsPerSample sets the "bits-per-sample" property.
1429// The number of bits per sample.
1430//
1431// Currently only 8 bit per sample are supported.
1432func (x *Pixbuf) SetPropertyBitsPerSample(value int) {
1433	var v gobject.Value
1434	v.Init(gobject.TypeIntVal)
1435	v.SetInt(value)
1436	x.SetProperty("bits-per-sample", &v)
1437}
1438
1439// GetPropertyBitsPerSample gets the "bits-per-sample" property.
1440// The number of bits per sample.
1441//
1442// Currently only 8 bit per sample are supported.
1443func (x *Pixbuf) GetPropertyBitsPerSample() int {
1444	var v gobject.Value
1445	x.GetProperty("bits-per-sample", &v)
1446	return v.GetInt()
1447}
1448
1449// SetPropertyHasAlpha sets the "has-alpha" property.
1450// Whether the pixbuf has an alpha channel.
1451func (x *Pixbuf) SetPropertyHasAlpha(value bool) {
1452	var v gobject.Value
1453	v.Init(gobject.TypeBooleanVal)
1454	v.SetBoolean(value)
1455	x.SetProperty("has-alpha", &v)
1456}
1457
1458// GetPropertyHasAlpha gets the "has-alpha" property.
1459// Whether the pixbuf has an alpha channel.
1460func (x *Pixbuf) GetPropertyHasAlpha() bool {
1461	var v gobject.Value
1462	x.GetProperty("has-alpha", &v)
1463	return v.GetBoolean()
1464}
1465
1466// SetPropertyHeight sets the "height" property.
1467// The number of rows of the pixbuf.
1468func (x *Pixbuf) SetPropertyHeight(value int) {
1469	var v gobject.Value
1470	v.Init(gobject.TypeIntVal)
1471	v.SetInt(value)
1472	x.SetProperty("height", &v)
1473}
1474
1475// GetPropertyHeight gets the "height" property.
1476// The number of rows of the pixbuf.
1477func (x *Pixbuf) GetPropertyHeight() int {
1478	var v gobject.Value
1479	x.GetProperty("height", &v)
1480	return v.GetInt()
1481}
1482
1483// SetPropertyNChannels sets the "n-channels" property.
1484// The number of samples per pixel.
1485//
1486// Currently, only 3 or 4 samples per pixel are supported.
1487func (x *Pixbuf) SetPropertyNChannels(value int) {
1488	var v gobject.Value
1489	v.Init(gobject.TypeIntVal)
1490	v.SetInt(value)
1491	x.SetProperty("n-channels", &v)
1492}
1493
1494// GetPropertyNChannels gets the "n-channels" property.
1495// The number of samples per pixel.
1496//
1497// Currently, only 3 or 4 samples per pixel are supported.
1498func (x *Pixbuf) GetPropertyNChannels() int {
1499	var v gobject.Value
1500	x.GetProperty("n-channels", &v)
1501	return v.GetInt()
1502}
1503
1504// SetPropertyPixelBytes sets the "pixel-bytes" property.
1505func (x *Pixbuf) SetPropertyPixelBytes(value uintptr) {
1506	var v gobject.Value
1507	v.Init(gobject.TypePointerVal)
1508	v.SetPointer(value)
1509	x.SetProperty("pixel-bytes", &v)
1510}
1511
1512// GetPropertyPixelBytes gets the "pixel-bytes" property.
1513func (x *Pixbuf) GetPropertyPixelBytes() uintptr {
1514	var v gobject.Value
1515	x.GetProperty("pixel-bytes", &v)
1516	return v.GetPointer()
1517}
1518
1519// SetPropertyPixels sets the "pixels" property.
1520// A pointer to the pixel data of the pixbuf.
1521func (x *Pixbuf) SetPropertyPixels(value uintptr) {
1522	var v gobject.Value
1523	v.Init(gobject.TypePointerVal)
1524	v.SetPointer(value)
1525	x.SetProperty("pixels", &v)
1526}
1527
1528// GetPropertyPixels gets the "pixels" property.
1529// A pointer to the pixel data of the pixbuf.
1530func (x *Pixbuf) GetPropertyPixels() uintptr {
1531	var v gobject.Value
1532	x.GetProperty("pixels", &v)
1533	return v.GetPointer()
1534}
1535
1536// SetPropertyRowstride sets the "rowstride" property.
1537// The number of bytes between the start of a row and
1538// the start of the next row.
1539//
1540// This number must (obviously) be at least as large as the
1541// width of the pixbuf.
1542func (x *Pixbuf) SetPropertyRowstride(value int) {
1543	var v gobject.Value
1544	v.Init(gobject.TypeIntVal)
1545	v.SetInt(value)
1546	x.SetProperty("rowstride", &v)
1547}
1548
1549// GetPropertyRowstride gets the "rowstride" property.
1550// The number of bytes between the start of a row and
1551// the start of the next row.
1552//
1553// This number must (obviously) be at least as large as the
1554// width of the pixbuf.
1555func (x *Pixbuf) GetPropertyRowstride() int {
1556	var v gobject.Value
1557	x.GetProperty("rowstride", &v)
1558	return v.GetInt()
1559}
1560
1561// SetPropertyWidth sets the "width" property.
1562// The number of columns of the pixbuf.
1563func (x *Pixbuf) SetPropertyWidth(value int) {
1564	var v gobject.Value
1565	v.Init(gobject.TypeIntVal)
1566	v.SetInt(value)
1567	x.SetProperty("width", &v)
1568}
1569
1570// GetPropertyWidth gets the "width" property.
1571// The number of columns of the pixbuf.
1572func (x *Pixbuf) GetPropertyWidth() int {
1573	var v gobject.Value
1574	x.GetProperty("width", &v)
1575	return v.GetInt()
1576}
1577
1578// Checks if two icons are equal.
1579func (x *Pixbuf) Equal(Icon2Var gio.Icon) bool {
1580
1581	cret := gio.XGIconEqual(x.GoPointer(), Icon2Var.GoPointer())
1582	return cret
1583}
1584
1585// Gets a hash for an icon.
1586func (x *Pixbuf) Hash() uint {
1587
1588	cret := gio.XGIconHash(x.GoPointer())
1589	return cret
1590}
1591
1592// Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved
1593// back by calling g_icon_deserialize() on the returned value.
1594// As serialization will avoid using raw icon data when possible, it only
1595// makes sense to transfer the #GVariant between processes on the same machine,
1596// (as opposed to over the network), and within the same file system namespace.
1597func (x *Pixbuf) Serialize() *glib.Variant {
1598
1599	cret := gio.XGIconSerialize(x.GoPointer())
1600	return cret
1601}
1602
1603// Generates a textual representation of @icon that can be used for
1604// serialization such as when passing @icon to a different process or
1605// saving it to persistent storage. Use g_icon_new_for_string() to
1606// get @icon back from the returned string.
1607//
1608// The encoding of the returned string is proprietary to #GIcon except
1609// in the following two cases
1610//
1611//   - If @icon is a #GFileIcon, the returned string is a native path
1612//     (such as `/path/to/my icon.png`) without escaping
1613//     if the #GFile for @icon is a native file.  If the file is not
1614//     native, the returned string is the result of g_file_get_uri()
1615//     (such as `sftp://path/to/my%20icon.png`).
1616//
1617//   - If @icon is a #GThemedIcon with exactly one name and no fallbacks,
1618//     the encoding is simply the name (such as `network-server`).
1619func (x *Pixbuf) ToString() string {
1620
1621	cret := gio.XGIconToString(x.GoPointer())
1622	return cret
1623}
1624
1625// Loads a loadable icon. For the asynchronous version of this function,
1626// see g_loadable_icon_load_async().
1627func (x *Pixbuf) Load(SizeVar int, TypeVar *string, CancellableVar *gio.Cancellable) (*gio.InputStream, error) {
1628	var cls *gio.InputStream
1629	var cerr *glib.Error
1630
1631	cret := gio.XGLoadableIconLoad(x.GoPointer(), SizeVar, TypeVar, CancellableVar.GoPointer(), &cerr)
1632
1633	if cret == 0 {
1634		return nil, cerr
1635	}
1636	cls = &gio.InputStream{}
1637	cls.Ptr = cret
1638	if cerr == nil {
1639		return cls, nil
1640	}
1641	return cls, cerr
1642
1643}
1644
1645// Loads an icon asynchronously. To finish this function, see
1646// g_loadable_icon_load_finish(). For the synchronous, blocking
1647// version of this function, see g_loadable_icon_load().
1648func (x *Pixbuf) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
1649
1650	gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
1651
1652}
1653
1654// Finishes an asynchronous icon load started in g_loadable_icon_load_async().
1655func (x *Pixbuf) LoadFinish(ResVar gio.AsyncResult, TypeVar *string) (*gio.InputStream, error) {
1656	var cls *gio.InputStream
1657	var cerr *glib.Error
1658
1659	cret := gio.XGLoadableIconLoadFinish(x.GoPointer(), ResVar.GoPointer(), TypeVar, &cerr)
1660
1661	if cret == 0 {
1662		return nil, cerr
1663	}
1664	cls = &gio.InputStream{}
1665	cls.Ptr = cret
1666	if cerr == nil {
1667		return cls, nil
1668	}
1669	return cls, cerr
1670
1671}
1672
1673var xPixbufCalculateRowstride func(Colorspace, bool, int, int, int) int
1674
1675// Calculates the rowstride that an image created with those values would
1676// have.
1677//
1678// This function is useful for front-ends and backends that want to check
1679// image values without needing to create a `GdkPixbuf`.
1680func PixbufCalculateRowstride(ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int) int {
1681
1682	cret := xPixbufCalculateRowstride(ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar)
1683	return cret
1684}
1685
1686var xPixbufGetFileInfo func(string, *int, *int) *PixbufFormat
1687
1688// Parses an image file far enough to determine its format and size.
1689func PixbufGetFileInfo(FilenameVar string, WidthVar *int, HeightVar *int) *PixbufFormat {
1690
1691	cret := xPixbufGetFileInfo(FilenameVar, WidthVar, HeightVar)
1692	return cret
1693}
1694
1695var xPixbufGetFileInfoAsync func(string, uintptr, uintptr, uintptr)
1696
1697// Asynchronously parses an image file far enough to determine its
1698// format and size.
1699//
1700// For more details see gdk_pixbuf_get_file_info(), which is the synchronous
1701// version of this function.
1702//
1703// When the operation is finished, @callback will be called in the
1704// main thread. You can then call gdk_pixbuf_get_file_info_finish() to
1705// get the result of the operation.
1706func PixbufGetFileInfoAsync(FilenameVar string, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
1707
1708	var CallbackVarRef uintptr
1709	if CallbackVar != nil {
1710		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1711		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1712			CallbackVarRef = cbRefPtr
1713		} else {
1714			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1715				cbFn := *CallbackVar
1716				cbFn(arg0, arg1, arg2)
1717			}
1718			CallbackVarRef = purego.NewCallback(fcb)
1719			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1720		}
1721	}
1722
1723	xPixbufGetFileInfoAsync(FilenameVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1724
1725}
1726
1727var xPixbufGetFileInfoFinish func(uintptr, *int, *int, **glib.Error) *PixbufFormat
1728
1729// Finishes an asynchronous pixbuf parsing operation started with
1730// gdk_pixbuf_get_file_info_async().
1731func PixbufGetFileInfoFinish(AsyncResultVar gio.AsyncResult, WidthVar *int, HeightVar *int) (*PixbufFormat, error) {
1732	var cerr *glib.Error
1733
1734	cret := xPixbufGetFileInfoFinish(AsyncResultVar.GoPointer(), WidthVar, HeightVar, &cerr)
1735	if cerr == nil {
1736		return cret, nil
1737	}
1738	return cret, cerr
1739
1740}
1741
1742var xPixbufGetFormats func() *glib.SList
1743
1744// Obtains the available information about the image formats supported
1745// by GdkPixbuf.
1746func PixbufGetFormats() *glib.SList {
1747
1748	cret := xPixbufGetFormats()
1749	return cret
1750}
1751
1752var xPixbufInitModules func(string, **glib.Error) bool
1753
1754// Initalizes the gdk-pixbuf loader modules referenced by the `loaders.cache`
1755// file present inside that directory.
1756//
1757// This is to be used by applications that want to ship certain loaders
1758// in a different location from the system ones.
1759//
1760// This is needed when the OS or runtime ships a minimal number of loaders
1761// so as to reduce the potential attack surface of carefully crafted image
1762// files, especially for uncommon file types. Applications that require
1763// broader image file types coverage, such as image viewers, would be
1764// expected to ship the gdk-pixbuf modules in a separate location, bundled
1765// with the application in a separate directory from the OS or runtime-
1766// provided modules.
1767func PixbufInitModules(PathVar string) (bool, error) {
1768	var cerr *glib.Error
1769
1770	cret := xPixbufInitModules(PathVar, &cerr)
1771	if cerr == nil {
1772		return cret, nil
1773	}
1774	return cret, cerr
1775
1776}
1777
1778var xPixbufNewFromStreamAsync func(uintptr, uintptr, uintptr, uintptr)
1779
1780// Creates a new pixbuf by asynchronously loading an image from an input stream.
1781//
1782// For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
1783// version of this function.
1784//
1785// When the operation is finished, @callback will be called in the main thread.
1786// You can then call gdk_pixbuf_new_from_stream_finish() to get the result of
1787// the operation.
1788func PixbufNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
1789
1790	var CallbackVarRef uintptr
1791	if CallbackVar != nil {
1792		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1793		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1794			CallbackVarRef = cbRefPtr
1795		} else {
1796			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1797				cbFn := *CallbackVar
1798				cbFn(arg0, arg1, arg2)
1799			}
1800			CallbackVarRef = purego.NewCallback(fcb)
1801			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1802		}
1803	}
1804
1805	xPixbufNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1806
1807}
1808
1809var xPixbufNewFromStreamAtScaleAsync func(uintptr, int, int, bool, uintptr, uintptr, uintptr)
1810
1811// Creates a new pixbuf by asynchronously loading an image from an input stream.
1812//
1813// For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the synchronous
1814// version of this function.
1815//
1816// When the operation is finished, @callback will be called in the main thread.
1817// You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
1818func PixbufNewFromStreamAtScaleAsync(StreamVar *gio.InputStream, WidthVar int, HeightVar int, PreserveAspectRatioVar bool, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
1819
1820	var CallbackVarRef uintptr
1821	if CallbackVar != nil {
1822		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
1823		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
1824			CallbackVarRef = cbRefPtr
1825		} else {
1826			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
1827				cbFn := *CallbackVar
1828				cbFn(arg0, arg1, arg2)
1829			}
1830			CallbackVarRef = purego.NewCallback(fcb)
1831			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
1832		}
1833	}
1834
1835	xPixbufNewFromStreamAtScaleAsync(StreamVar.GoPointer(), WidthVar, HeightVar, PreserveAspectRatioVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
1836
1837}
1838
1839var xPixbufSaveToStreamFinish func(uintptr, **glib.Error) bool
1840
1841// Finishes an asynchronous pixbuf save operation started with
1842// gdk_pixbuf_save_to_stream_async().
1843func PixbufSaveToStreamFinish(AsyncResultVar gio.AsyncResult) (bool, error) {
1844	var cerr *glib.Error
1845
1846	cret := xPixbufSaveToStreamFinish(AsyncResultVar.GoPointer(), &cerr)
1847	if cerr == nil {
1848		return cret, nil
1849	}
1850	return cret, cerr
1851
1852}
1853
1854func init() {
1855	core.SetPackageName("GDKPIXBUF", "gdk-pixbuf-2.0")
1856	core.SetSharedLibraries("GDKPIXBUF", []string{"libgdk_pixbuf-2.0.so.0"})
1857	var libs []uintptr
1858	for _, libPath := range core.GetPaths("GDKPIXBUF") {
1859		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1860		if err != nil {
1861			panic(err)
1862		}
1863		libs = append(libs, lib)
1864	}
1865
1866	core.PuregoSafeRegister(&xPixbufGLibType, libs, "gdk_pixbuf_get_type")
1867
1868	core.PuregoSafeRegister(&xNewPixbuf, libs, "gdk_pixbuf_new")
1869	core.PuregoSafeRegister(&xNewPixbufFromBytes, libs, "gdk_pixbuf_new_from_bytes")
1870	core.PuregoSafeRegister(&xNewPixbufFromData, libs, "gdk_pixbuf_new_from_data")
1871	core.PuregoSafeRegister(&xNewPixbufFromFile, libs, "gdk_pixbuf_new_from_file")
1872	core.PuregoSafeRegister(&xNewPixbufFromFileAtScale, libs, "gdk_pixbuf_new_from_file_at_scale")
1873	core.PuregoSafeRegister(&xNewPixbufFromFileAtSize, libs, "gdk_pixbuf_new_from_file_at_size")
1874	core.PuregoSafeRegister(&xNewPixbufFromInline, libs, "gdk_pixbuf_new_from_inline")
1875	core.PuregoSafeRegister(&xNewPixbufFromResource, libs, "gdk_pixbuf_new_from_resource")
1876	core.PuregoSafeRegister(&xNewPixbufFromResourceAtScale, libs, "gdk_pixbuf_new_from_resource_at_scale")
1877	core.PuregoSafeRegister(&xNewPixbufFromStream, libs, "gdk_pixbuf_new_from_stream")
1878	core.PuregoSafeRegister(&xNewPixbufFromStreamAtScale, libs, "gdk_pixbuf_new_from_stream_at_scale")
1879	core.PuregoSafeRegister(&xNewPixbufFromStreamFinish, libs, "gdk_pixbuf_new_from_stream_finish")
1880	core.PuregoSafeRegister(&xNewPixbufFromXpmData, libs, "gdk_pixbuf_new_from_xpm_data")
1881
1882	core.PuregoSafeRegister(&xPixbufAddAlpha, libs, "gdk_pixbuf_add_alpha")
1883	core.PuregoSafeRegister(&xPixbufApplyEmbeddedOrientation, libs, "gdk_pixbuf_apply_embedded_orientation")
1884	core.PuregoSafeRegister(&xPixbufComposite, libs, "gdk_pixbuf_composite")
1885	core.PuregoSafeRegister(&xPixbufCompositeColor, libs, "gdk_pixbuf_composite_color")
1886	core.PuregoSafeRegister(&xPixbufCompositeColorSimple, libs, "gdk_pixbuf_composite_color_simple")
1887	core.PuregoSafeRegister(&xPixbufCopy, libs, "gdk_pixbuf_copy")
1888	core.PuregoSafeRegister(&xPixbufCopyArea, libs, "gdk_pixbuf_copy_area")
1889	core.PuregoSafeRegister(&xPixbufCopyOptions, libs, "gdk_pixbuf_copy_options")
1890	core.PuregoSafeRegister(&xPixbufFill, libs, "gdk_pixbuf_fill")
1891	core.PuregoSafeRegister(&xPixbufFlip, libs, "gdk_pixbuf_flip")
1892	core.PuregoSafeRegister(&xPixbufGetBitsPerSample, libs, "gdk_pixbuf_get_bits_per_sample")
1893	core.PuregoSafeRegister(&xPixbufGetByteLength, libs, "gdk_pixbuf_get_byte_length")
1894	core.PuregoSafeRegister(&xPixbufGetColorspace, libs, "gdk_pixbuf_get_colorspace")
1895	core.PuregoSafeRegister(&xPixbufGetHasAlpha, libs, "gdk_pixbuf_get_has_alpha")
1896	core.PuregoSafeRegister(&xPixbufGetHeight, libs, "gdk_pixbuf_get_height")
1897	core.PuregoSafeRegister(&xPixbufGetNChannels, libs, "gdk_pixbuf_get_n_channels")
1898	core.PuregoSafeRegister(&xPixbufGetOption, libs, "gdk_pixbuf_get_option")
1899	core.PuregoSafeRegister(&xPixbufGetOptions, libs, "gdk_pixbuf_get_options")
1900	core.PuregoSafeRegister(&xPixbufGetPixels, libs, "gdk_pixbuf_get_pixels")
1901	core.PuregoSafeRegister(&xPixbufGetPixelsWithLength, libs, "gdk_pixbuf_get_pixels_with_length")
1902	core.PuregoSafeRegister(&xPixbufGetRowstride, libs, "gdk_pixbuf_get_rowstride")
1903	core.PuregoSafeRegister(&xPixbufGetWidth, libs, "gdk_pixbuf_get_width")
1904	core.PuregoSafeRegister(&xPixbufNewSubpixbuf, libs, "gdk_pixbuf_new_subpixbuf")
1905	core.PuregoSafeRegister(&xPixbufReadPixelBytes, libs, "gdk_pixbuf_read_pixel_bytes")
1906	core.PuregoSafeRegister(&xPixbufReadPixels, libs, "gdk_pixbuf_read_pixels")
1907	core.PuregoSafeRegister(&xPixbufRef, libs, "gdk_pixbuf_ref")
1908	core.PuregoSafeRegister(&xPixbufRemoveOption, libs, "gdk_pixbuf_remove_option")
1909	core.PuregoSafeRegister(&xPixbufRotateSimple, libs, "gdk_pixbuf_rotate_simple")
1910	core.PuregoSafeRegister(&xPixbufSaturateAndPixelate, libs, "gdk_pixbuf_saturate_and_pixelate")
1911	core.PuregoSafeRegister(&xPixbufSave, libs, "gdk_pixbuf_save")
1912	core.PuregoSafeRegister(&xPixbufSaveToBuffer, libs, "gdk_pixbuf_save_to_buffer")
1913	core.PuregoSafeRegister(&xPixbufSaveToBufferv, libs, "gdk_pixbuf_save_to_bufferv")
1914	core.PuregoSafeRegister(&xPixbufSaveToCallback, libs, "gdk_pixbuf_save_to_callback")
1915	core.PuregoSafeRegister(&xPixbufSaveToCallbackv, libs, "gdk_pixbuf_save_to_callbackv")
1916	core.PuregoSafeRegister(&xPixbufSaveToStream, libs, "gdk_pixbuf_save_to_stream")
1917	core.PuregoSafeRegister(&xPixbufSaveToStreamAsync, libs, "gdk_pixbuf_save_to_stream_async")
1918	core.PuregoSafeRegister(&xPixbufSaveToStreamv, libs, "gdk_pixbuf_save_to_streamv")
1919	core.PuregoSafeRegister(&xPixbufSaveToStreamvAsync, libs, "gdk_pixbuf_save_to_streamv_async")
1920	core.PuregoSafeRegister(&xPixbufSavev, libs, "gdk_pixbuf_savev")
1921	core.PuregoSafeRegister(&xPixbufScale, libs, "gdk_pixbuf_scale")
1922	core.PuregoSafeRegister(&xPixbufScaleSimple, libs, "gdk_pixbuf_scale_simple")
1923	core.PuregoSafeRegister(&xPixbufSetOption, libs, "gdk_pixbuf_set_option")
1924	core.PuregoSafeRegister(&xPixbufUnref, libs, "gdk_pixbuf_unref")
1925
1926	core.PuregoSafeRegister(&xPixbufCalculateRowstride, libs, "gdk_pixbuf_calculate_rowstride")
1927	core.PuregoSafeRegister(&xPixbufGetFileInfo, libs, "gdk_pixbuf_get_file_info")
1928	core.PuregoSafeRegister(&xPixbufGetFileInfoAsync, libs, "gdk_pixbuf_get_file_info_async")
1929	core.PuregoSafeRegister(&xPixbufGetFileInfoFinish, libs, "gdk_pixbuf_get_file_info_finish")
1930	core.PuregoSafeRegister(&xPixbufGetFormats, libs, "gdk_pixbuf_get_formats")
1931	core.PuregoSafeRegister(&xPixbufInitModules, libs, "gdk_pixbuf_init_modules")
1932	core.PuregoSafeRegister(&xPixbufNewFromStreamAsync, libs, "gdk_pixbuf_new_from_stream_async")
1933	core.PuregoSafeRegister(&xPixbufNewFromStreamAtScaleAsync, libs, "gdk_pixbuf_new_from_stream_at_scale_async")
1934	core.PuregoSafeRegister(&xPixbufSaveToStreamFinish, libs, "gdk_pixbuf_save_to_stream_finish")
1935
1936}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close