1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 /* GdkPixbuf library - Simple animation support
4 * Copyright (C) 1999 The Free Software Foundation
6 * Authors: Jonathan Blandford <jrb@redhat.com>
7 * Havoc Pennington <hp@redhat.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
27 #include "gdk-pixbuf-private.h"
28 #include "gdk-pixbuf-io.h"
29 #include "gdk-pixbuf-i18n.h"
30 #include "gdk-pixbuf-animation.h"
31 #include "gdk-pixbuf-alias.h"
33 #include <glib/gstdio.h>
35 typedef struct _GdkPixbufNonAnim GdkPixbufNonAnim;
36 typedef struct _GdkPixbufNonAnimClass GdkPixbufNonAnimClass;
38 #define GDK_TYPE_PIXBUF_NON_ANIM (gdk_pixbuf_non_anim_get_type ())
39 #define GDK_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnim))
40 #define GDK_IS_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM))
42 #define GDK_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
43 #define GDK_IS_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM))
44 #define GDK_PIXBUF_NON_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
46 /* Private part of the GdkPixbufNonAnim structure */
47 struct _GdkPixbufNonAnim {
48 GdkPixbufAnimation parent_instance;
53 struct _GdkPixbufNonAnimClass {
54 GdkPixbufAnimationClass parent_class;
58 static GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST;
62 typedef struct _GdkPixbufNonAnimIter GdkPixbufNonAnimIter;
63 typedef struct _GdkPixbufNonAnimIterClass GdkPixbufNonAnimIterClass;
66 #define GDK_TYPE_PIXBUF_NON_ANIM_ITER (gdk_pixbuf_non_anim_iter_get_type ())
67 #define GDK_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIter))
68 #define GDK_IS_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
70 #define GDK_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
71 #define GDK_IS_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
72 #define GDK_PIXBUF_NON_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
74 struct _GdkPixbufNonAnimIter {
75 GdkPixbufAnimationIter parent_instance;
77 GdkPixbufNonAnim *non_anim;
80 struct _GdkPixbufNonAnimIterClass {
81 GdkPixbufAnimationIterClass parent_class;
85 static GType gdk_pixbuf_non_anim_iter_get_type (void) G_GNUC_CONST;
90 gdk_pixbuf_animation_get_type (void)
92 static GType object_type = 0;
95 static const GTypeInfo object_info = {
96 sizeof (GdkPixbufAnimationClass),
98 (GBaseFinalizeFunc) NULL,
99 (GClassInitFunc) NULL,
100 NULL, /* class_finalize */
101 NULL, /* class_data */
102 sizeof (GdkPixbufAnimation),
104 (GInstanceInitFunc) NULL,
107 object_type = g_type_register_static (G_TYPE_OBJECT,
108 g_intern_static_string ("GdkPixbufAnimation"),
118 * gdk_pixbuf_animation_new_from_file:
119 * @filename: Name of file to load, in the GLib file name encoding
120 * @error: return location for error
122 * Creates a new animation by loading it from a file. The file format is
123 * detected automatically. If the file's format does not support multi-frame
124 * images, then an animation with a single frame will be created. Possible errors
125 * are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
127 * Return value: A newly-created animation with a reference count of 1, or %NULL
128 * if any of several error conditions ocurred: the file could not be opened,
129 * there was no loader for the file's format, there was not enough memory to
130 * allocate the image buffer, or the image file contained invalid data.
133 gdk_pixbuf_animation_new_from_file (const char *filename,
136 GdkPixbufAnimation *animation;
139 guchar buffer [1024];
140 GdkPixbufModule *image_module;
142 gboolean locked = FALSE;
144 g_return_val_if_fail (filename != NULL, NULL);
145 g_return_val_if_fail (error == NULL || *error == NULL, NULL);
147 display_name = g_filename_display_name (filename);
148 f = g_fopen (filename, "rb");
150 gint save_errno = errno;
153 g_file_error_from_errno (save_errno),
154 _("Failed to open file '%s': %s"),
156 g_strerror (save_errno));
157 g_free (display_name);
161 size = fread (&buffer, 1, sizeof (buffer), f);
166 GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
167 _("Image file '%s' contains no data"),
169 g_free (display_name);
174 image_module = _gdk_pixbuf_get_module (buffer, size, filename, error);
176 g_free (display_name);
181 if (image_module->module == NULL)
182 if (!_gdk_pixbuf_load_module (image_module, error)) {
183 g_free (display_name);
188 if (image_module->load_animation == NULL) {
191 /* Keep this logic in sync with gdk_pixbuf_new_from_file() */
193 fseek (f, 0, SEEK_SET);
194 pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
197 if (pixbuf == NULL && error != NULL && *error == NULL) {
198 /* I don't trust these crufty longjmp()'ing image libs
199 * to maintain proper error invariants, and I don't
200 * want user code to segfault as a result. We need to maintain
201 * the invariant that error gets set if NULL is returned.
204 g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
205 image_module->module_name);
208 GDK_PIXBUF_ERROR_FAILED,
209 _("Failed to load image '%s': reason not known, probably a corrupt image file"),
213 if (pixbuf == NULL) {
214 g_free (display_name);
219 animation = gdk_pixbuf_non_anim_new (pixbuf);
221 g_object_unref (pixbuf);
223 locked = _gdk_pixbuf_lock (image_module);
225 fseek (f, 0, SEEK_SET);
226 animation = (* image_module->load_animation) (f, error);
228 if (animation == NULL && error != NULL && *error == NULL) {
229 /* I don't trust these crufty longjmp()'ing
230 * image libs to maintain proper error
231 * invariants, and I don't want user code to
232 * segfault as a result. We need to maintain
233 * the invariant that error gets set if NULL
237 g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
238 image_module->module_name);
241 GDK_PIXBUF_ERROR_FAILED,
242 _("Failed to load animation '%s': reason not known, probably a corrupt animation file"),
249 g_free (display_name);
253 _gdk_pixbuf_unlock (image_module);
259 #undef gdk_pixbuf_animation_new_from_file
262 gdk_pixbuf_animation_new_from_file (const char *filename,
265 gchar *utf8_filename =
266 g_locale_to_utf8 (filename, -1, NULL, NULL, error);
267 GdkPixbufAnimation *retval;
269 if (utf8_filename == NULL)
272 retval = gdk_pixbuf_animation_new_from_file_utf8 (utf8_filename, error);
274 g_free (utf8_filename);
282 * gdk_pixbuf_animation_ref:
283 * @animation: An animation.
285 * Adds a reference to an animation.
287 * Return value: The same as the @animation argument.
289 * Deprecated: Use g_object_ref().
292 gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation)
294 return (GdkPixbufAnimation*) g_object_ref (animation);
298 * gdk_pixbuf_animation_unref:
299 * @animation: An animation.
301 * Removes a reference from an animation.
303 * Deprecated: Use g_object_unref().
306 gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
308 g_object_unref (animation);
312 * gdk_pixbuf_animation_is_static_image:
313 * @animation: a #GdkPixbufAnimation
315 * If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
316 * out to be a plain, unanimated image, then this function will return
317 * %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
320 * Return value: %TRUE if the "animation" was really just an image
323 gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation)
325 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), FALSE);
327 return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->is_static_image (animation);
331 * gdk_pixbuf_animation_get_static_image:
332 * @animation: a #GdkPixbufAnimation
334 * If an animation is really just a plain image (has only one frame),
335 * this function returns that image. If the animation is an animation,
336 * this function returns a reasonable thing to display as a static
337 * unanimated image, which might be the first frame, or something more
338 * sophisticated. If an animation hasn't loaded any frames yet, this
339 * function will return %NULL.
341 * Return value: unanimated image representing the animation
344 gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation)
346 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
348 return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_static_image (animation);
352 * gdk_pixbuf_animation_get_width:
353 * @animation: An animation.
355 * Queries the width of the bounding box of a pixbuf animation.
357 * Return value: Width of the bounding box of the animation.
360 gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
364 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
367 GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
375 * gdk_pixbuf_animation_get_height:
376 * @animation: An animation.
378 * Queries the height of the bounding box of a pixbuf animation.
380 * Return value: Height of the bounding box of the animation.
383 gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
387 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
390 GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
399 * gdk_pixbuf_animation_get_iter:
400 * @animation: a #GdkPixbufAnimation
401 * @start_time: time when the animation starts playing
403 * Get an iterator for displaying an animation. The iterator provides
404 * the frames that should be displayed at a given time.
405 * It should be freed after use with g_object_unref().
407 * @start_time would normally come from g_get_current_time(), and
408 * marks the beginning of animation playback. After creating an
409 * iterator, you should immediately display the pixbuf returned by
410 * gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a
411 * timeout (with g_timeout_add()) or by some other mechanism ensure
412 * that you'll update the image after
413 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
414 * the image is updated, you should reinstall the timeout with the new,
415 * possibly-changed delay time.
417 * As a shortcut, if @start_time is %NULL, the result of
418 * g_get_current_time() will be used automatically.
420 * To update the image (i.e. possibly change the result of
421 * gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
422 * call gdk_pixbuf_animation_iter_advance().
424 * If you're using #GdkPixbufLoader, in addition to updating the image
425 * after the delay time, you should also update it whenever you
426 * receive the area_updated signal and
427 * gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
428 * %TRUE. In this case, the frame currently being fed into the loader
429 * has received new data, so needs to be refreshed. The delay time for
430 * a frame may also be modified after an area_updated signal, for
431 * example if the delay time for a frame is encoded in the data after
432 * the frame itself. So your timeout should be reinstalled after any
433 * area_updated signal.
435 * A delay time of -1 is possible, indicating "infinite."
437 * Return value: an iterator to move over the animation
439 GdkPixbufAnimationIter*
440 gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
441 const GTimeVal *start_time)
445 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
451 g_get_current_time (&val);
453 return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_iter (animation, &val);
459 gdk_pixbuf_animation_iter_get_type (void)
461 static GType object_type = 0;
464 static const GTypeInfo object_info = {
465 sizeof (GdkPixbufAnimationIterClass),
466 (GBaseInitFunc) NULL,
467 (GBaseFinalizeFunc) NULL,
468 (GClassInitFunc) NULL,
469 NULL, /* class_finalize */
470 NULL, /* class_data */
471 sizeof (GdkPixbufAnimationIter),
473 (GInstanceInitFunc) NULL,
476 object_type = g_type_register_static (G_TYPE_OBJECT,
477 "GdkPixbufAnimationIter",
485 * gdk_pixbuf_animation_iter_get_delay_time:
486 * @iter: an animation iterator
488 * Gets the number of milliseconds the current pixbuf should be displayed,
489 * or -1 if the current pixbuf should be displayed forever. g_timeout_add()
490 * conveniently takes a timeout in milliseconds, so you can use a timeout
491 * to schedule the next update.
493 * Return value: delay time in milliseconds (thousandths of a second)
496 gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter)
498 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1);
500 return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time (iter);
504 * gdk_pixbuf_animation_iter_get_pixbuf:
505 * @iter: an animation iterator
507 * Gets the current pixbuf which should be displayed; the pixbuf will
508 * be the same size as the animation itself
509 * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
510 * This pixbuf should be displayed for
511 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
512 * of this function does not own a reference to the returned pixbuf;
513 * the returned pixbuf will become invalid when the iterator advances
514 * to the next frame, which may happen anytime you call
515 * gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
516 * (don't just add a reference), as it may get recycled as you advance
519 * Return value: the pixbuf to be displayed
522 gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
524 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), NULL);
526 return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf (iter);
530 * gdk_pixbuf_animation_iter_on_currently_loading_frame:
531 * @iter: a #GdkPixbufAnimationIter
533 * Used to determine how to respond to the area_updated signal on
534 * #GdkPixbufLoader when loading an animation. area_updated is emitted
535 * for an area of the frame currently streaming in to the loader. So if
536 * you're on the currently loading frame, you need to redraw the screen for
539 * Return value: %TRUE if the frame we're on is partially loaded, or the last frame
542 gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
544 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
546 return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame (iter);
550 * gdk_pixbuf_animation_iter_advance:
551 * @iter: a #GdkPixbufAnimationIter
552 * @current_time: current time
554 * Possibly advances an animation to a new frame. Chooses the frame based
555 * on the start time passed to gdk_pixbuf_animation_get_iter().
557 * @current_time would normally come from g_get_current_time(), and
558 * must be greater than or equal to the time passed to
559 * gdk_pixbuf_animation_get_iter(), and must increase or remain
560 * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
561 * called. That is, you can't go backward in time; animations only
564 * As a shortcut, pass %NULL for the current time and g_get_current_time()
565 * will be invoked on your behalf. So you only need to explicitly pass
566 * @current_time if you're doing something odd like playing the animation
569 * If this function returns %FALSE, there's no need to update the animation
570 * display, assuming the display had been rendered prior to advancing;
571 * if %TRUE, you need to call gdk_animation_iter_get_pixbuf() and update the
572 * display with the new pixbuf.
574 * Returns: %TRUE if the image may need updating
578 gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
579 const GTimeVal *current_time)
583 g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
588 g_get_current_time (&val);
590 return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val);
595 static void gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass);
596 static void gdk_pixbuf_non_anim_finalize (GObject *object);
598 static gboolean gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation);
599 static GdkPixbuf* gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation);
600 static void gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
603 static GdkPixbufAnimationIter* gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
604 const GTimeVal *start_time);
610 static gpointer non_parent_class;
613 gdk_pixbuf_non_anim_get_type (void)
615 static GType object_type = 0;
618 static const GTypeInfo object_info = {
619 sizeof (GdkPixbufNonAnimClass),
620 (GBaseInitFunc) NULL,
621 (GBaseFinalizeFunc) NULL,
622 (GClassInitFunc) gdk_pixbuf_non_anim_class_init,
623 NULL, /* class_finalize */
624 NULL, /* class_data */
625 sizeof (GdkPixbufNonAnim),
627 (GInstanceInitFunc) NULL,
630 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
639 gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass)
641 GObjectClass *object_class = G_OBJECT_CLASS (klass);
642 GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
644 non_parent_class = g_type_class_peek_parent (klass);
646 object_class->finalize = gdk_pixbuf_non_anim_finalize;
648 anim_class->is_static_image = gdk_pixbuf_non_anim_is_static_image;
649 anim_class->get_static_image = gdk_pixbuf_non_anim_get_static_image;
650 anim_class->get_size = gdk_pixbuf_non_anim_get_size;
651 anim_class->get_iter = gdk_pixbuf_non_anim_get_iter;
655 gdk_pixbuf_non_anim_finalize (GObject *object)
657 GdkPixbufNonAnim *non_anim = GDK_PIXBUF_NON_ANIM (object);
659 if (non_anim->pixbuf)
660 g_object_unref (non_anim->pixbuf);
662 G_OBJECT_CLASS (non_parent_class)->finalize (object);
666 gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf)
668 GdkPixbufNonAnim *non_anim;
670 non_anim = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM, NULL);
672 non_anim->pixbuf = pixbuf;
675 g_object_ref (pixbuf);
677 return GDK_PIXBUF_ANIMATION (non_anim);
681 gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation)
688 gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation)
690 GdkPixbufNonAnim *non_anim;
692 non_anim = GDK_PIXBUF_NON_ANIM (animation);
694 return non_anim->pixbuf;
698 gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
702 GdkPixbufNonAnim *non_anim;
704 non_anim = GDK_PIXBUF_NON_ANIM (anim);
707 *width = gdk_pixbuf_get_width (non_anim->pixbuf);
710 *height = gdk_pixbuf_get_height (non_anim->pixbuf);
714 static GdkPixbufAnimationIter*
715 gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
716 const GTimeVal *start_time)
718 GdkPixbufNonAnimIter *iter;
720 iter = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM_ITER, NULL);
722 iter->non_anim = GDK_PIXBUF_NON_ANIM (anim);
724 g_object_ref (iter->non_anim);
726 return GDK_PIXBUF_ANIMATION_ITER (iter);
731 static void gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass);
732 static void gdk_pixbuf_non_anim_iter_finalize (GObject *object);
733 static int gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
734 static GdkPixbuf* gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
735 static gboolean gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
736 static gboolean gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
737 const GTimeVal *current_time);
743 static gpointer non_iter_parent_class;
746 gdk_pixbuf_non_anim_iter_get_type (void)
748 static GType object_type = 0;
751 static const GTypeInfo object_info = {
752 sizeof (GdkPixbufNonAnimIterClass),
753 (GBaseInitFunc) NULL,
754 (GBaseFinalizeFunc) NULL,
755 (GClassInitFunc) gdk_pixbuf_non_anim_iter_class_init,
756 NULL, /* class_finalize */
757 NULL, /* class_data */
758 sizeof (GdkPixbufNonAnimIter),
760 (GInstanceInitFunc) NULL,
763 object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
764 "GdkPixbufNonAnimIter",
772 gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass)
774 GObjectClass *object_class = G_OBJECT_CLASS (klass);
775 GdkPixbufAnimationIterClass *anim_iter_class =
776 GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
778 non_iter_parent_class = g_type_class_peek_parent (klass);
780 object_class->finalize = gdk_pixbuf_non_anim_iter_finalize;
782 anim_iter_class->get_delay_time = gdk_pixbuf_non_anim_iter_get_delay_time;
783 anim_iter_class->get_pixbuf = gdk_pixbuf_non_anim_iter_get_pixbuf;
784 anim_iter_class->on_currently_loading_frame = gdk_pixbuf_non_anim_iter_on_currently_loading_frame;
785 anim_iter_class->advance = gdk_pixbuf_non_anim_iter_advance;
789 gdk_pixbuf_non_anim_iter_finalize (GObject *object)
791 GdkPixbufNonAnimIter *iter = GDK_PIXBUF_NON_ANIM_ITER (object);
793 g_object_unref (iter->non_anim);
795 G_OBJECT_CLASS (non_iter_parent_class)->finalize (object);
799 gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter)
801 return -1; /* show only frame forever */
805 gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
807 return GDK_PIXBUF_NON_ANIM_ITER (iter)->non_anim->pixbuf;
812 gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
818 gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
819 const GTimeVal *current_time)
822 /* Advancing never requires a refresh */
826 #define __GDK_PIXBUF_ANIMATION_C__
827 #include "gdk-pixbuf-aliasdef.c"