1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 /* GdkPixbuf library - GIF loader declarations
4 * Copyright (C) 1999 The Free Software Foundation
6 * Authors: Mark Crichton <crichton@gimp.org>
7 * Miguel de Icaza <miguel@gnu.org>
8 * Federico Mena-Quintero <federico@gimp.org>
9 * Havoc Pennington <hp@redhat.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
27 #ifndef GDK_PIXBUF_GIF_H
28 #define GDK_PIXBUF_GIF_H
30 #include "gdk-pixbuf-animation.h"
33 /* Keep this frame and composite next frame over it */
34 /* (GIF disposal method 1) */
35 GDK_PIXBUF_FRAME_RETAIN,
36 /* Revert to background color before compositing next frame */
37 /* (GIF disposal method 2) */
38 GDK_PIXBUF_FRAME_DISPOSE,
39 /* Revert to previously-displayed composite image after
40 * displaying this frame
42 /* (GIF disposal method 3) */
43 GDK_PIXBUF_FRAME_REVERT
44 } GdkPixbufFrameAction;
48 typedef struct _GdkPixbufGifAnim GdkPixbufGifAnim;
49 typedef struct _GdkPixbufGifAnimClass GdkPixbufGifAnimClass;
50 typedef struct _GdkPixbufFrame GdkPixbufFrame;
52 #define GDK_TYPE_PIXBUF_GIF_ANIM (gdk_pixbuf_gif_anim_get_type ())
53 #define GDK_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnim))
54 #define GDK_IS_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM))
56 #define GDK_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass))
57 #define GDK_IS_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM))
58 #define GDK_PIXBUF_GIF_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass))
60 /* Private part of the GdkPixbufGifAnim structure */
61 struct _GdkPixbufGifAnim {
62 GdkPixbufAnimation parent_instance;
64 /* Number of frames */
67 /* Total length of animation */
70 /* List of GdkPixbufFrame structures */
73 /* bounding box size */
84 struct _GdkPixbufGifAnimClass {
85 GdkPixbufAnimationClass parent_class;
89 GType gdk_pixbuf_gif_anim_get_type (void) G_GNUC_CONST;
93 typedef struct _GdkPixbufGifAnimIter GdkPixbufGifAnimIter;
94 typedef struct _GdkPixbufGifAnimIterClass GdkPixbufGifAnimIterClass;
97 #define GDK_TYPE_PIXBUF_GIF_ANIM_ITER (gdk_pixbuf_gif_anim_iter_get_type ())
98 #define GDK_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIter))
99 #define GDK_IS_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
101 #define GDK_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
102 #define GDK_IS_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
103 #define GDK_PIXBUF_GIF_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
105 struct _GdkPixbufGifAnimIter {
106 GdkPixbufAnimationIter parent_instance;
108 GdkPixbufGifAnim *gif_anim;
111 GTimeVal current_time;
113 /* Time in milliseconds into this run of the animation */
116 GList *current_frame;
118 gint first_loop_slowness;
121 struct _GdkPixbufGifAnimIterClass {
122 GdkPixbufAnimationIterClass parent_class;
126 GType gdk_pixbuf_gif_anim_iter_get_type (void) G_GNUC_CONST;
130 struct _GdkPixbufFrame {
131 /* The pixbuf with this frame's image data */
134 /* Offsets for overlaying onto the GIF graphic area */
138 /* Frame duration in ms */
141 /* Sum of preceding delay times */
145 GdkPixbufFrameAction action;
147 /* TRUE if the pixbuf has been modified since
148 * the last frame composite operation
150 gboolean need_recomposite;
152 /* TRUE if the background for this frame is transparent */
153 gboolean bg_transparent;
155 /* The below reflects the "use hell of a lot of RAM"
156 * philosophy of coding
159 /* Cached composite image (the image you actually display
162 GdkPixbuf *composited;
164 /* Cached revert image (the contents of the area
165 * covered by the frame prior to compositing;
166 * same size as pixbuf, not as the composite image; only
167 * used for FRAME_REVERT frames)
172 void gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
173 GdkPixbufFrame *frame);