#include <config.h>
#include "gdk-pixbuf-io.h"
+#include "gdk-pixbuf-private.h"
\f
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);
*
* 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;
}
/**
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;
+}