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 */
83 struct _GdkPixbufGifAnimClass {
84 GdkPixbufAnimationClass parent_class;
88 GType gdk_pixbuf_gif_anim_get_type (void) G_GNUC_CONST;
92 typedef struct _GdkPixbufGifAnimIter GdkPixbufGifAnimIter;
93 typedef struct _GdkPixbufGifAnimIterClass GdkPixbufGifAnimIterClass;
96 #define GDK_TYPE_PIXBUF_GIF_ANIM_ITER (gdk_pixbuf_gif_anim_iter_get_type ())
97 #define GDK_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIter))
98 #define GDK_IS_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
100 #define GDK_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
101 #define GDK_IS_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
102 #define GDK_PIXBUF_GIF_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
104 struct _GdkPixbufGifAnimIter {
105 GdkPixbufAnimationIter parent_instance;
107 GdkPixbufGifAnim *gif_anim;
110 GTimeVal current_time;
112 /* Time in milliseconds into this run of the animation */
115 GList *current_frame;
118 struct _GdkPixbufGifAnimIterClass {
119 GdkPixbufAnimationIterClass parent_class;
123 GType gdk_pixbuf_gif_anim_iter_get_type (void) G_GNUC_CONST;
127 struct _GdkPixbufFrame {
128 /* The pixbuf with this frame's image data */
131 /* Offsets for overlaying onto the GIF graphic area */
135 /* Frame duration in ms */
138 /* Sum of preceding delay times */
142 GdkPixbufFrameAction action;
144 /* TRUE if the pixbuf has been modified since
145 * the last frame composite operation
147 gboolean need_recomposite;
149 /* TRUE if the background for this frame is transparent */
150 gboolean bg_transparent;
152 /* The below reflects the "use hell of a lot of RAM"
153 * philosophy of coding
156 /* Cached composite image (the image you actually display
159 GdkPixbuf *composited;
161 /* Cached revert image (the contents of the area
162 * covered by the frame prior to compositing;
163 * same size as pixbuf, not as the composite image; only
164 * used for FRAME_REVERT frames)
169 void gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
170 GdkPixbufFrame *frame);