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, see <http://www.gnu.org/licenses/>. |
23 | */ |
24 | |
25 | #ifndef GDK_PIXBUF_GIF_H |
26 | #define GDK_PIXBUF_GIF_H |
27 | |
28 | #include "gdk-pixbuf-animation.h" |
29 | |
30 | typedef enum { |
31 | /* Keep this frame and composite next frame over it */ |
32 | /* (GIF disposal method 1) */ |
33 | GDK_PIXBUF_FRAME_RETAIN, |
34 | /* Revert to background color before compositing next frame */ |
35 | /* (GIF disposal method 2) */ |
36 | GDK_PIXBUF_FRAME_DISPOSE, |
37 | /* Revert to previously-displayed composite image after |
38 | * displaying this frame |
39 | */ |
40 | /* (GIF disposal method 3) */ |
41 | GDK_PIXBUF_FRAME_REVERT |
42 | } GdkPixbufFrameAction; |
43 | |
44 | |
45 | |
46 | typedef struct _GdkPixbufGifAnim GdkPixbufGifAnim; |
47 | typedef struct _GdkPixbufGifAnimClass GdkPixbufGifAnimClass; |
48 | typedef struct _GdkPixbufFrame GdkPixbufFrame; |
49 | |
50 | #define GDK_TYPE_PIXBUF_GIF_ANIM (gdk_pixbuf_gif_anim_get_type ()) |
51 | #define GDK_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnim)) |
52 | #define GDK_IS_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM)) |
53 | |
54 | #define GDK_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass)) |
55 | #define GDK_IS_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM)) |
56 | #define GDK_PIXBUF_GIF_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass)) |
57 | |
58 | /* Private part of the GdkPixbufGifAnim structure */ |
59 | struct _GdkPixbufGifAnim { |
60 | GdkPixbufAnimation parent_instance; |
61 | |
62 | /* Total length of animation */ |
63 | int total_time; |
64 | |
65 | /* Color map */ |
66 | guchar color_map[256 * 3]; |
67 | |
68 | /* List of GdkPixbufFrame structures */ |
69 | GList *frames; |
70 | |
71 | /* bounding box size */ |
72 | int width, height; |
73 | |
74 | int loop; |
75 | |
76 | /* Last rendered frames */ |
77 | GdkPixbuf *last_frame_data; |
78 | GdkPixbufFrame *last_frame; |
79 | GdkPixbuf *last_frame_revert_data; |
80 | }; |
81 | |
82 | struct _GdkPixbufGifAnimClass { |
83 | GdkPixbufAnimationClass parent_class; |
84 | |
85 | }; |
86 | |
87 | GType gdk_pixbuf_gif_anim_get_type (void) G_GNUC_CONST; |
88 | |
89 | |
90 | |
91 | typedef struct _GdkPixbufGifAnimIter GdkPixbufGifAnimIter; |
92 | typedef struct _GdkPixbufGifAnimIterClass GdkPixbufGifAnimIterClass; |
93 | |
94 | |
95 | #define GDK_TYPE_PIXBUF_GIF_ANIM_ITER (gdk_pixbuf_gif_anim_iter_get_type ()) |
96 | #define GDK_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIter)) |
97 | #define GDK_IS_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER)) |
98 | |
99 | #define GDK_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass)) |
100 | #define GDK_IS_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER)) |
101 | #define GDK_PIXBUF_GIF_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass)) |
102 | |
103 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
104 | struct _GdkPixbufGifAnimIter { |
105 | GdkPixbufAnimationIter parent_instance; |
106 | |
107 | GdkPixbufGifAnim *gif_anim; |
108 | |
109 | GTimeVal start_time; |
110 | GTimeVal current_time; |
111 | |
112 | /* Time in milliseconds into this run of the animation */ |
113 | gint position; |
114 | |
115 | GList *current_frame; |
116 | |
117 | gint first_loop_slowness; |
118 | }; |
119 | G_GNUC_END_IGNORE_DEPRECATIONS |
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 | |
129 | |
130 | struct _GdkPixbufFrame { |
131 | /* Compressed frame data */ |
132 | GByteArray *lzw_data; |
133 | guint8 lzw_code_size; |
134 | |
135 | /* Position of frame data in image */ |
136 | int x_offset; |
137 | int y_offset; |
138 | guint16 width; |
139 | guint16 height; |
140 | |
141 | /* Layout of pixels */ |
142 | gboolean interlace; |
143 | |
144 | /* Color map */ |
145 | gboolean color_map_allocated; |
146 | guchar *color_map; |
147 | |
148 | /* Transparency */ |
149 | int transparent_index; |
150 | |
151 | /* Frame duration in ms */ |
152 | int delay_time; |
153 | |
154 | /* Sum of preceding delay times */ |
155 | int elapsed; |
156 | |
157 | /* Overlay mode */ |
158 | GdkPixbufFrameAction action; |
159 | }; |
160 | |
161 | #endif |
162 | |