Synopsis#include <gdk-pixbuf/gdk-pixbuf.h> GdkPixbufAnimation; GdkPixbufAnimationIter; GdkPixbufAnimation* gdk_pixbuf_animation_new_from_file (const char *filename, GError **error); GdkPixbufAnimation* gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation); void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation); int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation); int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation); GdkPixbufAnimationIter* gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation, const GTimeVal *start_time); gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation); GdkPixbuf* gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation); gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, const GTimeVal *current_time); int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter); gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter); GdkPixbuf* gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter); GdkPixbufSimpleAnim; GdkPixbufSimpleAnim* gdk_pixbuf_simple_anim_new (gint width, gint height, gfloat rate); void gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation, GdkPixbuf *pixbuf); DescriptionThe gdk-pixbuf library provides a simple mechanism to load and represent animations. An animation is conceptually a series of frames to be displayed over time. Each frame is the same size. The animation may not be represented as a series of frames internally; for example, it may be stored as a sprite and instructions for moving the sprite around a background. To display an animation you don't need to understand its representation, however; you just ask gdk-pixbuf what should be displayed at a given point in time. DetailsGdkPixbufAnimationtypedef struct _GdkPixbufAnimation GdkPixbufAnimation; And opaque struct representing an animation. GdkPixbufAnimationItertypedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; And opaque struct representing an iterator which points to a certain position in an animation. gdk_pixbuf_animation_new_from_file ()GdkPixbufAnimation* gdk_pixbuf_animation_new_from_file (const char *filename, GError **error); Creates a new animation by loading it from a file. The file format is detected automatically. If the file's format does not support multi-frame images, then an animation with a single frame will be created. Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
gdk_pixbuf_animation_ref ()GdkPixbufAnimation* gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation); Warning
Adds a reference to an animation.
gdk_pixbuf_animation_unref ()void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation); Warning
Removes a reference from an animation.
gdk_pixbuf_animation_get_width ()int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation); Queries the width of the bounding box of a pixbuf animation.
gdk_pixbuf_animation_get_height ()int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation); Queries the height of the bounding box of a pixbuf animation.
gdk_pixbuf_animation_get_iter ()GdkPixbufAnimationIter* gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation, const GTimeVal *start_time);
Get an iterator for displaying an animation. The iterator provides
the frames that should be displayed at a given time.
It should be freed after use with
As a shortcut, if
To update the image (i.e. possibly change the result of
If you're using GdkPixbufLoader, in addition to updating the image
after the delay time, you should also update it whenever you
receive the area_updated signal and
A delay time of -1 is possible, indicating "infinite."
gdk_pixbuf_animation_is_static_image ()gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
If you load a file with
gdk_pixbuf_animation_get_static_image ()GdkPixbuf* gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
If an animation is really just a plain image (has only one frame),
this function returns that image. If the animation is an animation,
this function returns a reasonable thing to display as a static
unanimated image, which might be the first frame, or something more
sophisticated. If an animation hasn't loaded any frames yet, this
function will return
gdk_pixbuf_animation_iter_advance ()gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, const GTimeVal *current_time);
Possibly advances an animation to a new frame. Chooses the frame based
on the start time passed to
As a shortcut, pass
If this function returns
gdk_pixbuf_animation_iter_get_delay_time ()int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
Gets the number of milliseconds the current pixbuf should be displayed,
or -1 if the current pixbuf should be displayed forever.
gdk_pixbuf_animation_iter_on_currently_loading_frame ()gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter); Used to determine how to respond to the area_updated signal on GdkPixbufLoader when loading an animation. area_updated is emitted for an area of the frame currently streaming in to the loader. So if you're on the currently loading frame, you need to redraw the screen for the updated area.
gdk_pixbuf_animation_iter_get_pixbuf ()GdkPixbuf* gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
Gets the current pixbuf which should be displayed; the pixbuf will
be the same size as the animation itself
(
gdk_pixbuf_simple_anim_new ()GdkPixbufSimpleAnim* gdk_pixbuf_simple_anim_new (gint width, gint height, gfloat rate); Creates a new, empty animation.
Since 2.8 gdk_pixbuf_simple_anim_add_frame ()void gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation, GdkPixbuf *pixbuf);
Adds a new frame to
Since 2.8 |