summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>1999-12-11 00:21:27 +0000
committerJonathan Blandford <jrb@src.gnome.org>1999-12-11 00:21:27 +0000
commitd723183795d0f3df801262770f5198e5403e685f (patch)
tree72f6358bc180772070fe518ad8f5239215b180d3 /gdk-pixbuf/gdk-pixbuf.c
parent0b0ebee941d724daddb624319517702d703bf16e (diff)
downloadgtk+-d723183795d0f3df801262770f5198e5403e685f.tar.gz
thinking about the new loading API.
1999-12-10 Jonathan Blandford <jrb@redhat.com> * gdk-pixbuf/gdk-pixbuf-io.h: thinking about the new loading API. * gdk-pixbuf/gdk-pixbuf-drawable.c (gdk_pixbuf_get_from_drawable): make a warning go away.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
index 6c9b2730eb..ed276e55e0 100644
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ b/gdk-pixbuf/gdk-pixbuf.c
@@ -292,3 +292,57 @@ gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf)
return (pixbuf->art_pixbuf->rowstride);
}
+
+
+/**
+ * gdk_pixbuf_animation_new_from_file:
+ * @filename: The filename.
+ *
+ * Creates a new @GdkPixbufAnimation with @filename loaded as the animation. If
+ * @filename doesn't exist or is an invalid file, the @n_frames member will be
+ * 0. If @filename is a static image (and not an animation) then the @n_frames
+ * member will be 1.
+ *
+ * Return value: A newly created GdkPixbufAnimation.
+ **/
+GdkPixbufAnimation *
+gdk_pixbuf_animation_new_from_file (const char *filename)
+{
+ GdkPixbufAnimation *retval;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ retval = g_new (GdkPixbufAnimation, 1);
+ retval->n_frames = 0;
+ retval->frames = NULL;
+
+ return retval;
+}
+
+/**
+ * gdk_pixbuf_animation_destroy:
+ * @animation: An animation.
+ * @free_frames: Keep the frames.
+ *
+ * Destroys the animation. If @free_frames is set, then the actual image data
+ * will be free'd as well.
+ *
+ **/
+void
+gdk_pixbuf_animation_destroy (GdkPixbufAnimation *animation,
+ gboolean free_frames)
+{
+ GList *ptr;
+
+ g_return_if_fail (animation != NULL);
+
+ for (ptr = animation->frames; ptr; ptr = g_list_next (ptr)) {
+ if (free_frames)
+ gdk_pixbuf_unref (((GdkPixbufFrame *)ptr->data)->pixbuf);
+ g_free (ptr->data);
+ }
+ g_list_free (animation->frames);
+
+ g_free (animation);
+}
+