]> Pileus Git - ~andy/gtk/blobdiff - gdk-pixbuf/gdk-pixbuf-animation.c
Your eyes are bloodshot.
[~andy/gtk] / gdk-pixbuf / gdk-pixbuf-animation.c
index 5e9e0d17e97391afd92cba251cb3cb636e7358dd..beb5b29394626d9500e1b510cd831d2915be2e3e 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <config.h>
 #include "gdk-pixbuf-io.h"
+#include "gdk-pixbuf-private.h"
 
 \f
 
@@ -102,6 +103,8 @@ gdk_pixbuf_animation_new_from_file (const char *filename)
                animation->ref_count = 1;
                animation->n_frames = 1;
                animation->frames = g_list_prepend (NULL, frame);
+               animation->width = gdk_pixbuf_get_width (pixbuf);
+               animation->height = gdk_pixbuf_get_height (pixbuf);
        } else {
                fseek (f, 0, SEEK_SET);
                animation = (* image_module->load_animation) (f);
@@ -117,14 +120,17 @@ gdk_pixbuf_animation_new_from_file (const char *filename)
  *
  * Adds a reference to an animation.  It must be released afterwards using
  * gdk_pixbuf_animation_unref().
+ *
+ * Return value: The same as the @animation argument.
  **/
-void
+GdkPixbufAnimation *
 gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation)
 {
-       g_return_if_fail (animation != NULL);
-       g_return_if_fail (animation->ref_count > 0);
+       g_return_val_if_fail (animation != NULL, NULL);
+       g_return_val_if_fail (animation->ref_count > 0, NULL);
 
        animation->ref_count++;
+       return animation;
 }
 
 /**
@@ -157,3 +163,150 @@ gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
                g_free (animation);
        }
 }
+
+/**
+ * gdk_pixbuf_animation_get_width:
+ * @animation: An animation.
+ *
+ * Queries the width of the bounding box of a pixbuf animation.
+ * 
+ * Return value: Width of the bounding box of the animation.
+ **/
+int
+gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
+{
+       g_return_val_if_fail (animation != NULL, -1);
+
+       return animation->width;
+}
+
+/**
+ * gdk_pixbuf_animation_get_height:
+ * @animation: An animation.
+ *
+ * Queries the height of the bounding box of a pixbuf animation.
+ * 
+ * Return value: Height of the bounding box of the animation.
+ **/
+int
+gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
+{
+       g_return_val_if_fail (animation != NULL, -1);
+
+       return animation->height;
+}
+
+/**
+ * gdk_pixbuf_animation_get_num_frames:
+ * @animation: An animation.
+ *
+ * Queries the number of frames in a pixbuf animation.
+ * 
+ * Return value: Number of frames in the animation.
+ **/
+int
+gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation)
+{
+       g_return_val_if_fail (animation != NULL, -1);
+
+       return animation->n_frames;
+}
+
+/**
+ * gdk_pixbuf_animation_get_frames:
+ * @animation: An animation.
+ *
+ * Queries the list of frames of an animation.
+ * 
+ * Return value: List of frames in the animation; this is a #GList of
+ * #GdkPixbufFrame structures.
+ **/
+GList *
+gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation)
+{
+       g_return_val_if_fail (animation != NULL, NULL);
+
+       return animation->frames;
+}
+
+\f
+
+/**
+ * gdk_pixbuf_frame_get_pixbuf:
+ * @frame: A pixbuf animation frame.
+ * 
+ * Queries the pixbuf of an animation frame.
+ * 
+ * Return value: A pixbuf.
+ **/
+GdkPixbuf *
+gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame)
+{
+       g_return_val_if_fail (frame != NULL, NULL);
+
+       return frame->pixbuf;
+}
+
+/**
+ * gdk_pixbuf_frame_get_x_offset:
+ * @frame: A pixbuf animation frame.
+ * 
+ * Queries the X offset of an animation frame.
+ * 
+ * Return value: X offset from the top left corner of the animation.
+ **/
+int
+gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame)
+{
+       g_return_val_if_fail (frame != NULL, -1);
+
+       return frame->x_offset;
+}
+
+/**
+ * gdk_pixbuf_frame_get_y_offset:
+ * @frame: A pixbuf animation frame.
+ * 
+ * Queries the Y offset of an animation frame.
+ * 
+ * Return value: Y offset from the top left corner of the animation.
+ **/
+int
+gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame)
+{
+       g_return_val_if_fail (frame != NULL, -1);
+
+       return frame->y_offset;
+}
+
+/**
+ * gdk_pixbuf_frame_get_delay_time:
+ * @frame: A pixbuf animation frame.
+ * 
+ * Queries the delay time in milliseconds of an animation frame.
+ * 
+ * Return value: Delay time in milliseconds.
+ **/
+int
+gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame)
+{
+       g_return_val_if_fail (frame != NULL, -1);
+
+       return frame->delay_time;
+}
+
+/**
+ * gdk_pixbuf_frame_get_action:
+ * @frame: A pixbuf animation frame.
+ * 
+ * Queries the overlay action of an animation frame.
+ * 
+ * Return value: Overlay action for this frame.
+ **/
+GdkPixbufFrameAction
+gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame)
+{
+       g_return_val_if_fail (frame != NULL, GDK_PIXBUF_FRAME_RETAIN);
+
+       return frame->action;
+}