1// Package gdkpixbuf was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gdkpixbuf
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gio"
12 "github.com/bnema/puregotk/v4/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17// Modules supporting animations must derive a type from
18// #GdkPixbufAnimation, providing suitable implementations of the
19// virtual functions.
20type PixbufAnimationClass struct {
21 _ structs.HostLayout
22
23 ParentClass gobject.ObjectClass
24
25 xIsStaticImage uintptr
26
27 xGetStaticImage uintptr
28
29 xGetSize uintptr
30
31 xGetIter uintptr
32}
33
34func (x *PixbufAnimationClass) GoPointer() uintptr {
35 return uintptr(unsafe.Pointer(x))
36}
37
38// OverrideIsStaticImage sets the "is_static_image" callback function.
39// returns whether the given animation is just a static image.
40func (x *PixbufAnimationClass) OverrideIsStaticImage(cb func(*PixbufAnimation) bool) {
41 if cb == nil {
42 x.xIsStaticImage = 0
43 } else {
44 x.xIsStaticImage = purego.NewCallback(func(AnimationVarp uintptr) bool {
45 return cb(PixbufAnimationNewFromInternalPtr(AnimationVarp))
46 })
47 }
48}
49
50// GetIsStaticImage gets the "is_static_image" callback function.
51// returns whether the given animation is just a static image.
52func (x *PixbufAnimationClass) GetIsStaticImage() func(*PixbufAnimation) bool {
53 if x.xIsStaticImage == 0 {
54 return nil
55 }
56 var rawCallback func(AnimationVarp uintptr) bool
57 purego.RegisterFunc(&rawCallback, x.xIsStaticImage)
58 return func(AnimationVar *PixbufAnimation) bool {
59 return rawCallback(AnimationVar.GoPointer())
60 }
61}
62
63// OverrideGetStaticImage sets the "get_static_image" callback function.
64// returns a static image representing the given animation.
65func (x *PixbufAnimationClass) OverrideGetStaticImage(cb func(*PixbufAnimation) *Pixbuf) {
66 if cb == nil {
67 x.xGetStaticImage = 0
68 } else {
69 x.xGetStaticImage = purego.NewCallback(func(AnimationVarp uintptr) uintptr {
70 ret := cb(PixbufAnimationNewFromInternalPtr(AnimationVarp))
71 if ret == nil {
72 return 0
73 }
74 return ret.GoPointer()
75 })
76 }
77}
78
79// GetGetStaticImage gets the "get_static_image" callback function.
80// returns a static image representing the given animation.
81func (x *PixbufAnimationClass) GetGetStaticImage() func(*PixbufAnimation) *Pixbuf {
82 if x.xGetStaticImage == 0 {
83 return nil
84 }
85 var rawCallback func(AnimationVarp uintptr) uintptr
86 purego.RegisterFunc(&rawCallback, x.xGetStaticImage)
87 return func(AnimationVar *PixbufAnimation) *Pixbuf {
88 rawRet := rawCallback(AnimationVar.GoPointer())
89 if rawRet == 0 {
90 return nil
91 }
92 ret := &Pixbuf{}
93 ret.Ptr = rawRet
94 return ret
95 }
96}
97
98// OverrideGetSize sets the "get_size" callback function.
99// fills @width and @height with the frame size of the animation.
100func (x *PixbufAnimationClass) OverrideGetSize(cb func(*PixbufAnimation, int, int)) {
101 if cb == nil {
102 x.xGetSize = 0
103 } else {
104 x.xGetSize = purego.NewCallback(func(AnimationVarp uintptr, WidthVarp int, HeightVarp int) {
105 cb(PixbufAnimationNewFromInternalPtr(AnimationVarp), WidthVarp, HeightVarp)
106 })
107 }
108}
109
110// GetGetSize gets the "get_size" callback function.
111// fills @width and @height with the frame size of the animation.
112func (x *PixbufAnimationClass) GetGetSize() func(*PixbufAnimation, int, int) {
113 if x.xGetSize == 0 {
114 return nil
115 }
116 var rawCallback func(AnimationVarp uintptr, WidthVarp int, HeightVarp int)
117 purego.RegisterFunc(&rawCallback, x.xGetSize)
118 return func(AnimationVar *PixbufAnimation, WidthVar int, HeightVar int) {
119 rawCallback(AnimationVar.GoPointer(), WidthVar, HeightVar)
120 }
121}
122
123// OverrideGetIter sets the "get_iter" callback function.
124// returns an iterator for the given animation.
125func (x *PixbufAnimationClass) OverrideGetIter(cb func(*PixbufAnimation, *glib.TimeVal) *PixbufAnimationIter) {
126 if cb == nil {
127 x.xGetIter = 0
128 } else {
129 x.xGetIter = purego.NewCallback(func(AnimationVarp uintptr, StartTimeVarp *glib.TimeVal) uintptr {
130 ret := cb(PixbufAnimationNewFromInternalPtr(AnimationVarp), StartTimeVarp)
131 if ret == nil {
132 return 0
133 }
134 return ret.GoPointer()
135 })
136 }
137}
138
139// GetGetIter gets the "get_iter" callback function.
140// returns an iterator for the given animation.
141func (x *PixbufAnimationClass) GetGetIter() func(*PixbufAnimation, *glib.TimeVal) *PixbufAnimationIter {
142 if x.xGetIter == 0 {
143 return nil
144 }
145 var rawCallback func(AnimationVarp uintptr, StartTimeVarp *glib.TimeVal) uintptr
146 purego.RegisterFunc(&rawCallback, x.xGetIter)
147 return func(AnimationVar *PixbufAnimation, StartTimeVar *glib.TimeVal) *PixbufAnimationIter {
148 rawRet := rawCallback(AnimationVar.GoPointer(), StartTimeVar)
149 if rawRet == 0 {
150 return nil
151 }
152 ret := &PixbufAnimationIter{}
153 ret.Ptr = rawRet
154 return ret
155 }
156}
157
158// Modules supporting animations must derive a type from
159// #GdkPixbufAnimationIter, providing suitable implementations of the
160// virtual functions.
161type PixbufAnimationIterClass struct {
162 _ structs.HostLayout
163
164 ParentClass gobject.ObjectClass
165
166 xGetDelayTime uintptr
167
168 xGetPixbuf uintptr
169
170 xOnCurrentlyLoadingFrame uintptr
171
172 xAdvance uintptr
173}
174
175func (x *PixbufAnimationIterClass) GoPointer() uintptr {
176 return uintptr(unsafe.Pointer(x))
177}
178
179// OverrideGetDelayTime sets the "get_delay_time" callback function.
180// returns the time in milliseconds that the current frame
181//
182// should be shown.
183func (x *PixbufAnimationIterClass) OverrideGetDelayTime(cb func(*PixbufAnimationIter) int) {
184 if cb == nil {
185 x.xGetDelayTime = 0
186 } else {
187 x.xGetDelayTime = purego.NewCallback(func(IterVarp uintptr) int {
188 return cb(PixbufAnimationIterNewFromInternalPtr(IterVarp))
189 })
190 }
191}
192
193// GetGetDelayTime gets the "get_delay_time" callback function.
194// returns the time in milliseconds that the current frame
195//
196// should be shown.
197func (x *PixbufAnimationIterClass) GetGetDelayTime() func(*PixbufAnimationIter) int {
198 if x.xGetDelayTime == 0 {
199 return nil
200 }
201 var rawCallback func(IterVarp uintptr) int
202 purego.RegisterFunc(&rawCallback, x.xGetDelayTime)
203 return func(IterVar *PixbufAnimationIter) int {
204 return rawCallback(IterVar.GoPointer())
205 }
206}
207
208// OverrideGetPixbuf sets the "get_pixbuf" callback function.
209// returns the current frame.
210func (x *PixbufAnimationIterClass) OverrideGetPixbuf(cb func(*PixbufAnimationIter) *Pixbuf) {
211 if cb == nil {
212 x.xGetPixbuf = 0
213 } else {
214 x.xGetPixbuf = purego.NewCallback(func(IterVarp uintptr) uintptr {
215 ret := cb(PixbufAnimationIterNewFromInternalPtr(IterVarp))
216 if ret == nil {
217 return 0
218 }
219 return ret.GoPointer()
220 })
221 }
222}
223
224// GetGetPixbuf gets the "get_pixbuf" callback function.
225// returns the current frame.
226func (x *PixbufAnimationIterClass) GetGetPixbuf() func(*PixbufAnimationIter) *Pixbuf {
227 if x.xGetPixbuf == 0 {
228 return nil
229 }
230 var rawCallback func(IterVarp uintptr) uintptr
231 purego.RegisterFunc(&rawCallback, x.xGetPixbuf)
232 return func(IterVar *PixbufAnimationIter) *Pixbuf {
233 rawRet := rawCallback(IterVar.GoPointer())
234 if rawRet == 0 {
235 return nil
236 }
237 ret := &Pixbuf{}
238 ret.Ptr = rawRet
239 return ret
240 }
241}
242
243// OverrideOnCurrentlyLoadingFrame sets the "on_currently_loading_frame" callback function.
244// returns whether the current frame of @iter is
245//
246// being loaded.
247func (x *PixbufAnimationIterClass) OverrideOnCurrentlyLoadingFrame(cb func(*PixbufAnimationIter) bool) {
248 if cb == nil {
249 x.xOnCurrentlyLoadingFrame = 0
250 } else {
251 x.xOnCurrentlyLoadingFrame = purego.NewCallback(func(IterVarp uintptr) bool {
252 return cb(PixbufAnimationIterNewFromInternalPtr(IterVarp))
253 })
254 }
255}
256
257// GetOnCurrentlyLoadingFrame gets the "on_currently_loading_frame" callback function.
258// returns whether the current frame of @iter is
259//
260// being loaded.
261func (x *PixbufAnimationIterClass) GetOnCurrentlyLoadingFrame() func(*PixbufAnimationIter) bool {
262 if x.xOnCurrentlyLoadingFrame == 0 {
263 return nil
264 }
265 var rawCallback func(IterVarp uintptr) bool
266 purego.RegisterFunc(&rawCallback, x.xOnCurrentlyLoadingFrame)
267 return func(IterVar *PixbufAnimationIter) bool {
268 return rawCallback(IterVar.GoPointer())
269 }
270}
271
272// OverrideAdvance sets the "advance" callback function.
273// advances the iterator to @current_time, possibly changing the
274//
275// current frame.
276func (x *PixbufAnimationIterClass) OverrideAdvance(cb func(*PixbufAnimationIter, *glib.TimeVal) bool) {
277 if cb == nil {
278 x.xAdvance = 0
279 } else {
280 x.xAdvance = purego.NewCallback(func(IterVarp uintptr, CurrentTimeVarp *glib.TimeVal) bool {
281 return cb(PixbufAnimationIterNewFromInternalPtr(IterVarp), CurrentTimeVarp)
282 })
283 }
284}
285
286// GetAdvance gets the "advance" callback function.
287// advances the iterator to @current_time, possibly changing the
288//
289// current frame.
290func (x *PixbufAnimationIterClass) GetAdvance() func(*PixbufAnimationIter, *glib.TimeVal) bool {
291 if x.xAdvance == 0 {
292 return nil
293 }
294 var rawCallback func(IterVarp uintptr, CurrentTimeVarp *glib.TimeVal) bool
295 purego.RegisterFunc(&rawCallback, x.xAdvance)
296 return func(IterVar *PixbufAnimationIter, CurrentTimeVar *glib.TimeVal) bool {
297 return rawCallback(IterVar.GoPointer(), CurrentTimeVar)
298 }
299}
300
301// An opaque object representing an animation.
302//
303// The GdkPixBuf library provides a simple mechanism to load and
304// represent animations. An animation is conceptually a series of
305// frames to be displayed over time.
306//
307// The animation may not be represented as a series of frames
308// internally; for example, it may be stored as a sprite and
309// instructions for moving the sprite around a background.
310//
311// To display an animation you don't need to understand its
312// representation, however; you just ask `GdkPixbuf` what should
313// be displayed at a given point in time.
314type PixbufAnimation struct {
315 gobject.Object
316}
317
318var xPixbufAnimationGLibType func() types.GType
319
320func PixbufAnimationGLibType() types.GType {
321 return xPixbufAnimationGLibType()
322}
323
324func PixbufAnimationNewFromInternalPtr(ptr uintptr) *PixbufAnimation {
325 cls := &PixbufAnimation{}
326 cls.Ptr = ptr
327 return cls
328}
329
330var xNewPixbufAnimationFromFile func(string, **glib.Error) uintptr
331
332// Creates a new animation by loading it from a file.
333//
334// The file format is detected automatically.
335//
336// If the file's format does not support multi-frame images, then an animation
337// with a single frame will be created.
338//
339// Possible errors are in the `GDK_PIXBUF_ERROR` and `G_FILE_ERROR` domains.
340func NewPixbufAnimationFromFile(FilenameVar string) (*PixbufAnimation, error) {
341 var cls *PixbufAnimation
342 var cerr *glib.Error
343
344 cret := xNewPixbufAnimationFromFile(FilenameVar, &cerr)
345
346 if cret == 0 {
347 return nil, cerr
348 }
349 cls = &PixbufAnimation{}
350 cls.Ptr = cret
351 if cerr == nil {
352 return cls, nil
353 }
354 return cls, cerr
355
356}
357
358var xNewPixbufAnimationFromResource func(string, **glib.Error) uintptr
359
360// Creates a new pixbuf animation by loading an image from an resource.
361//
362// The file format is detected automatically. If `NULL` is returned, then
363// @error will be set.
364func NewPixbufAnimationFromResource(ResourcePathVar string) (*PixbufAnimation, error) {
365 var cls *PixbufAnimation
366 var cerr *glib.Error
367
368 cret := xNewPixbufAnimationFromResource(ResourcePathVar, &cerr)
369
370 if cret == 0 {
371 return nil, cerr
372 }
373 cls = &PixbufAnimation{}
374 cls.Ptr = cret
375 if cerr == nil {
376 return cls, nil
377 }
378 return cls, cerr
379
380}
381
382var xNewPixbufAnimationFromStream func(uintptr, uintptr, **glib.Error) uintptr
383
384// Creates a new animation by loading it from an input stream.
385//
386// The file format is detected automatically.
387//
388// If `NULL` is returned, then @error will be set.
389//
390// The @cancellable can be used to abort the operation from another thread.
391// If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be
392// returned. Other possible errors are in the `GDK_PIXBUF_ERROR` and
393// `G_IO_ERROR` domains.
394//
395// The stream is not closed.
396func NewPixbufAnimationFromStream(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable) (*PixbufAnimation, error) {
397 var cls *PixbufAnimation
398 var cerr *glib.Error
399
400 cret := xNewPixbufAnimationFromStream(StreamVar.GoPointer(), CancellableVar.GoPointer(), &cerr)
401
402 if cret == 0 {
403 return nil, cerr
404 }
405 cls = &PixbufAnimation{}
406 cls.Ptr = cret
407 if cerr == nil {
408 return cls, nil
409 }
410 return cls, cerr
411
412}
413
414var xNewPixbufAnimationFromStreamFinish func(uintptr, **glib.Error) uintptr
415
416// Finishes an asynchronous pixbuf animation creation operation started with
417// [func@GdkPixbuf.PixbufAnimation.new_from_stream_async].
418func NewPixbufAnimationFromStreamFinish(AsyncResultVar gio.AsyncResult) (*PixbufAnimation, error) {
419 var cls *PixbufAnimation
420 var cerr *glib.Error
421
422 cret := xNewPixbufAnimationFromStreamFinish(AsyncResultVar.GoPointer(), &cerr)
423
424 if cret == 0 {
425 return nil, cerr
426 }
427 cls = &PixbufAnimation{}
428 cls.Ptr = cret
429 if cerr == nil {
430 return cls, nil
431 }
432 return cls, cerr
433
434}
435
436var xPixbufAnimationGetHeight func(uintptr) int
437
438// Queries the height of the bounding box of a pixbuf animation.
439func (x *PixbufAnimation) GetHeight() int {
440
441 cret := xPixbufAnimationGetHeight(x.GoPointer())
442 return cret
443}
444
445var xPixbufAnimationGetIter func(uintptr, *glib.TimeVal) uintptr
446
447// Get an iterator for displaying an animation.
448//
449// The iterator provides the frames that should be displayed at a
450// given time.
451//
452// @start_time would normally come from g_get_current_time(), and marks
453// the beginning of animation playback. After creating an iterator, you
454// should immediately display the pixbuf returned by
455// gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install
456// a timeout (with g_timeout_add()) or by some other mechanism ensure
457// that you'll update the image after
458// gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
459// the image is updated, you should reinstall the timeout with the new,
460// possibly-changed delay time.
461//
462// As a shortcut, if @start_time is `NULL`, the result of
463// g_get_current_time() will be used automatically.
464//
465// To update the image (i.e. possibly change the result of
466// gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
467// call gdk_pixbuf_animation_iter_advance().
468//
469// If you're using #GdkPixbufLoader, in addition to updating the image
470// after the delay time, you should also update it whenever you
471// receive the area_updated signal and
472// gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
473// `TRUE`. In this case, the frame currently being fed into the loader
474// has received new data, so needs to be refreshed. The delay time for
475// a frame may also be modified after an area_updated signal, for
476// example if the delay time for a frame is encoded in the data after
477// the frame itself. So your timeout should be reinstalled after any
478// area_updated signal.
479//
480// A delay time of -1 is possible, indicating "infinite".
481func (x *PixbufAnimation) GetIter(StartTimeVar *glib.TimeVal) *PixbufAnimationIter {
482 var cls *PixbufAnimationIter
483
484 cret := xPixbufAnimationGetIter(x.GoPointer(), StartTimeVar)
485
486 if cret == 0 {
487 return nil
488 }
489 cls = &PixbufAnimationIter{}
490 cls.Ptr = cret
491 return cls
492}
493
494var xPixbufAnimationGetStaticImage func(uintptr) uintptr
495
496// Retrieves a static image for the animation.
497//
498// If an animation is really just a plain image (has only one frame),
499// this function returns that image.
500//
501// If the animation is an animation, this function returns a reasonable
502// image to use as a static unanimated image, which might be the first
503// frame, or something more sophisticated depending on the file format.
504//
505// If an animation hasn't loaded any frames yet, this function will
506// return `NULL`.
507func (x *PixbufAnimation) GetStaticImage() *Pixbuf {
508 var cls *Pixbuf
509
510 cret := xPixbufAnimationGetStaticImage(x.GoPointer())
511
512 if cret == 0 {
513 return nil
514 }
515 gobject.IncreaseRef(cret)
516 cls = &Pixbuf{}
517 cls.Ptr = cret
518 return cls
519}
520
521var xPixbufAnimationGetWidth func(uintptr) int
522
523// Queries the width of the bounding box of a pixbuf animation.
524func (x *PixbufAnimation) GetWidth() int {
525
526 cret := xPixbufAnimationGetWidth(x.GoPointer())
527 return cret
528}
529
530var xPixbufAnimationIsStaticImage func(uintptr) bool
531
532// Checks whether the animation is a static image.
533//
534// If you load a file with gdk_pixbuf_animation_new_from_file() and it
535// turns out to be a plain, unanimated image, then this function will
536// return `TRUE`. Use gdk_pixbuf_animation_get_static_image() to retrieve
537// the image.
538func (x *PixbufAnimation) IsStaticImage() bool {
539
540 cret := xPixbufAnimationIsStaticImage(x.GoPointer())
541 return cret
542}
543
544var xPixbufAnimationRef func(uintptr) uintptr
545
546// Adds a reference to an animation.
547func (x *PixbufAnimation) Ref() *PixbufAnimation {
548 var cls *PixbufAnimation
549
550 cret := xPixbufAnimationRef(x.GoPointer())
551
552 if cret == 0 {
553 return nil
554 }
555 cls = &PixbufAnimation{}
556 cls.Ptr = cret
557 return cls
558}
559
560var xPixbufAnimationUnref func(uintptr)
561
562// Removes a reference from an animation.
563func (x *PixbufAnimation) Unref() {
564
565 xPixbufAnimationUnref(x.GoPointer())
566
567}
568
569func (c *PixbufAnimation) GoPointer() uintptr {
570 if c == nil {
571 return 0
572 }
573 return c.Ptr
574}
575
576func (c *PixbufAnimation) SetGoPointer(ptr uintptr) {
577 c.Ptr = ptr
578}
579
580var xPixbufAnimationNewFromStreamAsync func(uintptr, uintptr, uintptr, uintptr)
581
582// Creates a new animation by asynchronously loading an image from an input stream.
583//
584// For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
585// version of this function.
586//
587// When the operation is finished, `callback` will be called in the main thread.
588// You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the
589// result of the operation.
590func PixbufAnimationNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) {
591
592 var CallbackVarRef uintptr
593 if CallbackVar != nil {
594 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
595 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
596 CallbackVarRef = cbRefPtr
597 } else {
598 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
599 cbFn := *CallbackVar
600 cbFn(arg0, arg1, arg2)
601 }
602 CallbackVarRef = purego.NewCallback(fcb)
603 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
604 }
605 }
606
607 xPixbufAnimationNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
608
609}
610
611// An opaque object representing an iterator which points to a
612// certain position in an animation.
613type PixbufAnimationIter struct {
614 gobject.Object
615}
616
617var xPixbufAnimationIterGLibType func() types.GType
618
619func PixbufAnimationIterGLibType() types.GType {
620 return xPixbufAnimationIterGLibType()
621}
622
623func PixbufAnimationIterNewFromInternalPtr(ptr uintptr) *PixbufAnimationIter {
624 cls := &PixbufAnimationIter{}
625 cls.Ptr = ptr
626 return cls
627}
628
629var xPixbufAnimationIterAdvance func(uintptr, *glib.TimeVal) bool
630
631// Possibly advances an animation to a new frame.
632//
633// Chooses the frame based on the start time passed to
634// gdk_pixbuf_animation_get_iter().
635//
636// @current_time would normally come from g_get_current_time(), and
637// must be greater than or equal to the time passed to
638// gdk_pixbuf_animation_get_iter(), and must increase or remain
639// unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
640// called. That is, you can't go backward in time; animations only
641// play forward.
642//
643// As a shortcut, pass `NULL` for the current time and g_get_current_time()
644// will be invoked on your behalf. So you only need to explicitly pass
645// @current_time if you're doing something odd like playing the animation
646// at double speed.
647//
648// If this function returns `FALSE`, there's no need to update the animation
649// display, assuming the display had been rendered prior to advancing;
650// if `TRUE`, you need to call gdk_pixbuf_animation_iter_get_pixbuf()
651// and update the display with the new pixbuf.
652func (x *PixbufAnimationIter) Advance(CurrentTimeVar *glib.TimeVal) bool {
653
654 cret := xPixbufAnimationIterAdvance(x.GoPointer(), CurrentTimeVar)
655 return cret
656}
657
658var xPixbufAnimationIterGetDelayTime func(uintptr) int
659
660// Gets the number of milliseconds the current pixbuf should be displayed,
661// or -1 if the current pixbuf should be displayed forever.
662//
663// The `g_timeout_add()` function conveniently takes a timeout in milliseconds,
664// so you can use a timeout to schedule the next update.
665//
666// Note that some formats, like GIF, might clamp the timeout values in the
667// image file to avoid updates that are just too quick. The minimum timeout
668// for GIF images is currently 20 milliseconds.
669func (x *PixbufAnimationIter) GetDelayTime() int {
670
671 cret := xPixbufAnimationIterGetDelayTime(x.GoPointer())
672 return cret
673}
674
675var xPixbufAnimationIterGetPixbuf func(uintptr) uintptr
676
677// Gets the current pixbuf which should be displayed.
678//
679// The pixbuf might not be the same size as the animation itself
680// (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
681//
682// This pixbuf should be displayed for gdk_pixbuf_animation_iter_get_delay_time()
683// milliseconds.
684//
685// The caller of this function does not own a reference to the returned
686// pixbuf; the returned pixbuf will become invalid when the iterator
687// advances to the next frame, which may happen anytime you call
688// gdk_pixbuf_animation_iter_advance().
689//
690// Copy the pixbuf to keep it (don't just add a reference), as it may get
691// recycled as you advance the iterator.
692func (x *PixbufAnimationIter) GetPixbuf() *Pixbuf {
693 var cls *Pixbuf
694
695 cret := xPixbufAnimationIterGetPixbuf(x.GoPointer())
696
697 if cret == 0 {
698 return nil
699 }
700 gobject.IncreaseRef(cret)
701 cls = &Pixbuf{}
702 cls.Ptr = cret
703 return cls
704}
705
706var xPixbufAnimationIterOnCurrentlyLoadingFrame func(uintptr) bool
707
708// Used to determine how to respond to the area_updated signal on
709// #GdkPixbufLoader when loading an animation.
710//
711// The `::area_updated` signal is emitted for an area of the frame currently
712// streaming in to the loader. So if you're on the currently loading frame,
713// you will need to redraw the screen for the updated area.
714func (x *PixbufAnimationIter) OnCurrentlyLoadingFrame() bool {
715
716 cret := xPixbufAnimationIterOnCurrentlyLoadingFrame(x.GoPointer())
717 return cret
718}
719
720func (c *PixbufAnimationIter) GoPointer() uintptr {
721 if c == nil {
722 return 0
723 }
724 return c.Ptr
725}
726
727func (c *PixbufAnimationIter) SetGoPointer(ptr uintptr) {
728 c.Ptr = ptr
729}
730
731func init() {
732 core.SetPackageName("GDKPIXBUF", "gdk-pixbuf-2.0")
733 core.SetSharedLibraries("GDKPIXBUF", []string{"libgdk_pixbuf-2.0.so.0"})
734 var libs []uintptr
735 for _, libPath := range core.GetPaths("GDKPIXBUF") {
736 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
737 if err != nil {
738 panic(err)
739 }
740 libs = append(libs, lib)
741 }
742
743 core.PuregoSafeRegister(&xPixbufAnimationGLibType, libs, "gdk_pixbuf_animation_get_type")
744
745 core.PuregoSafeRegister(&xNewPixbufAnimationFromFile, libs, "gdk_pixbuf_animation_new_from_file")
746 core.PuregoSafeRegister(&xNewPixbufAnimationFromResource, libs, "gdk_pixbuf_animation_new_from_resource")
747 core.PuregoSafeRegister(&xNewPixbufAnimationFromStream, libs, "gdk_pixbuf_animation_new_from_stream")
748 core.PuregoSafeRegister(&xNewPixbufAnimationFromStreamFinish, libs, "gdk_pixbuf_animation_new_from_stream_finish")
749
750 core.PuregoSafeRegister(&xPixbufAnimationGetHeight, libs, "gdk_pixbuf_animation_get_height")
751 core.PuregoSafeRegister(&xPixbufAnimationGetIter, libs, "gdk_pixbuf_animation_get_iter")
752 core.PuregoSafeRegister(&xPixbufAnimationGetStaticImage, libs, "gdk_pixbuf_animation_get_static_image")
753 core.PuregoSafeRegister(&xPixbufAnimationGetWidth, libs, "gdk_pixbuf_animation_get_width")
754 core.PuregoSafeRegister(&xPixbufAnimationIsStaticImage, libs, "gdk_pixbuf_animation_is_static_image")
755 core.PuregoSafeRegister(&xPixbufAnimationRef, libs, "gdk_pixbuf_animation_ref")
756 core.PuregoSafeRegister(&xPixbufAnimationUnref, libs, "gdk_pixbuf_animation_unref")
757
758 core.PuregoSafeRegister(&xPixbufAnimationNewFromStreamAsync, libs, "gdk_pixbuf_animation_new_from_stream_async")
759
760 core.PuregoSafeRegister(&xPixbufAnimationIterGLibType, libs, "gdk_pixbuf_animation_iter_get_type")
761
762 core.PuregoSafeRegister(&xPixbufAnimationIterAdvance, libs, "gdk_pixbuf_animation_iter_advance")
763 core.PuregoSafeRegister(&xPixbufAnimationIterGetDelayTime, libs, "gdk_pixbuf_animation_iter_get_delay_time")
764 core.PuregoSafeRegister(&xPixbufAnimationIterGetPixbuf, libs, "gdk_pixbuf_animation_iter_get_pixbuf")
765 core.PuregoSafeRegister(&xPixbufAnimationIterOnCurrentlyLoadingFrame, libs, "gdk_pixbuf_animation_iter_on_currently_loading_frame")
766
767}