]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/io-gif-animation.h
[quartz] Delete the typedef of GdkDevicePrivate
[~andy/gtk] / gdk-pixbuf / io-gif-animation.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 /* GdkPixbuf library - GIF loader declarations
3  *
4  * Copyright (C) 1999 The Free Software Foundation
5  *
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>
10  *
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.
15  *
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.
20  *
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.
25  */
26
27 #ifndef GDK_PIXBUF_GIF_H
28 #define GDK_PIXBUF_GIF_H
29
30 #include "gdk-pixbuf-animation.h"
31
32 typedef enum {
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
41          */
42         /* (GIF disposal method 3) */
43         GDK_PIXBUF_FRAME_REVERT
44 } GdkPixbufFrameAction;
45
46 \f
47
48 typedef struct _GdkPixbufGifAnim GdkPixbufGifAnim;
49 typedef struct _GdkPixbufGifAnimClass GdkPixbufGifAnimClass;
50 typedef struct _GdkPixbufFrame GdkPixbufFrame;
51
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))
55
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))
59
60 /* Private part of the GdkPixbufGifAnim structure */
61 struct _GdkPixbufGifAnim {
62         GdkPixbufAnimation parent_instance;
63
64         /* Number of frames */
65         int n_frames;
66
67         /* Total length of animation */
68         int total_time;
69         
70         /* List of GdkPixbufFrame structures */
71         GList *frames;
72
73         /* bounding box size */
74         int width, height;
75
76         guchar bg_red;
77         guchar bg_green;
78         guchar bg_blue;
79         
80         int loop;
81         gboolean loading;
82 };
83
84 struct _GdkPixbufGifAnimClass {
85         GdkPixbufAnimationClass parent_class;
86         
87 };
88
89 GType gdk_pixbuf_gif_anim_get_type (void) G_GNUC_CONST;
90
91 \f
92
93 typedef struct _GdkPixbufGifAnimIter GdkPixbufGifAnimIter;
94 typedef struct _GdkPixbufGifAnimIterClass GdkPixbufGifAnimIterClass;
95
96
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))
100
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))
104
105 struct _GdkPixbufGifAnimIter {
106         GdkPixbufAnimationIter parent_instance;
107         
108         GdkPixbufGifAnim   *gif_anim;
109
110         GTimeVal            start_time;
111         GTimeVal            current_time;
112
113         /* Time in milliseconds into this run of the animation */
114         gint                position;
115         
116         GList              *current_frame;
117         
118         gint                first_loop_slowness;
119 };
120
121 struct _GdkPixbufGifAnimIterClass {
122         GdkPixbufAnimationIterClass parent_class;
123
124 };
125
126 GType gdk_pixbuf_gif_anim_iter_get_type (void) G_GNUC_CONST;
127
128 \f
129
130 struct _GdkPixbufFrame {
131         /* The pixbuf with this frame's image data */
132         GdkPixbuf *pixbuf;
133
134         /* Offsets for overlaying onto the GIF graphic area */
135         int x_offset;
136         int y_offset;
137
138         /* Frame duration in ms */
139         int delay_time;
140
141         /* Sum of preceding delay times */
142         int elapsed;
143         
144         /* Overlay mode */
145         GdkPixbufFrameAction action;
146
147         /* TRUE if the pixbuf has been modified since
148          * the last frame composite operation
149          */
150         gboolean need_recomposite;
151
152         /* TRUE if the background for this frame is transparent */
153         gboolean bg_transparent;
154         
155         /* The below reflects the "use hell of a lot of RAM"
156          * philosophy of coding
157          */
158         
159         /* Cached composite image (the image you actually display
160          * for this frame)
161          */
162         GdkPixbuf *composited;
163
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)
168          */
169         GdkPixbuf *revert;
170 };
171
172 void gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
173                                           GdkPixbufFrame   *frame);
174
175 #endif