1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ |
2 | /* GdkPixbuf library - Animation support |
3 | * |
4 | * Copyright (C) 1999 The Free Software Foundation |
5 | * |
6 | * Authors: Mark Crichton <[email protected]> |
7 | * Miguel de Icaza <[email protected]> |
8 | * Federico Mena-Quintero <[email protected]> |
9 | * Havoc Pennington <[email protected]> |
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_ANIMATION_H |
26 | #define GDK_PIXBUF_ANIMATION_H |
27 | |
28 | #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION) |
29 | #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly." |
30 | #endif |
31 | |
32 | #include <glib-object.h> |
33 | #include <gdk-pixbuf/gdk-pixbuf-core.h> |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | /* Animation support */ |
38 | |
39 | /** |
40 | * GdkPixbufAnimation: |
41 | * |
42 | * An opaque struct representing an animation. |
43 | */ |
44 | typedef struct _GdkPixbufAnimation GdkPixbufAnimation; |
45 | |
46 | |
47 | /** |
48 | * GdkPixbufAnimationIter: |
49 | * |
50 | * An opaque struct representing an iterator which points to a |
51 | * certain position in an animation. |
52 | */ |
53 | typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; |
54 | |
55 | #define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ()) |
56 | #define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation)) |
57 | #define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION)) |
58 | |
59 | #define GDK_TYPE_PIXBUF_ANIMATION_ITER (gdk_pixbuf_animation_iter_get_type ()) |
60 | #define GDK_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIter)) |
61 | #define GDK_IS_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER)) |
62 | |
63 | GDK_PIXBUF_AVAILABLE_IN_ALL |
64 | GType gdk_pixbuf_animation_get_type (void) G_GNUC_CONST; |
65 | |
66 | #ifdef G_OS_WIN32 |
67 | /* API/ABI compat, see gdk-pixbuf-core.h for details */ |
68 | GDK_PIXBUF_AVAILABLE_IN_ALL |
69 | GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file_utf8 (const char *filename, |
70 | GError **error); |
71 | #endif |
72 | |
73 | GDK_PIXBUF_AVAILABLE_IN_ALL |
74 | GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename, |
75 | GError **error); |
76 | GDK_PIXBUF_AVAILABLE_IN_2_28 |
77 | GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream (GInputStream *stream, |
78 | GCancellable *cancellable, |
79 | GError **error); |
80 | GDK_PIXBUF_AVAILABLE_IN_2_28 |
81 | void gdk_pixbuf_animation_new_from_stream_async (GInputStream *stream, |
82 | GCancellable *cancellable, |
83 | GAsyncReadyCallback callback, |
84 | gpointer user_data); |
85 | GDK_PIXBUF_AVAILABLE_IN_2_28 |
86 | GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream_finish (GAsyncResult*async_result, |
87 | GError **error); |
88 | GDK_PIXBUF_AVAILABLE_IN_2_28 |
89 | GdkPixbufAnimation *gdk_pixbuf_animation_new_from_resource(const char *resource_path, |
90 | GError **error); |
91 | |
92 | #ifndef GDK_PIXBUF_DISABLE_DEPRECATED |
93 | |
94 | GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_ref) |
95 | GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation); |
96 | GDK_PIXBUF_DEPRECATED_IN_2_0_FOR(g_object_unref) |
97 | void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation); |
98 | #endif |
99 | |
100 | GDK_PIXBUF_AVAILABLE_IN_ALL |
101 | int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation); |
102 | GDK_PIXBUF_AVAILABLE_IN_ALL |
103 | int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation); |
104 | GDK_PIXBUF_AVAILABLE_IN_ALL |
105 | gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation); |
106 | GDK_PIXBUF_AVAILABLE_IN_ALL |
107 | GdkPixbuf *gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation); |
108 | |
109 | GDK_PIXBUF_AVAILABLE_IN_ALL |
110 | GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation, |
111 | const GTimeVal *start_time); |
112 | GDK_PIXBUF_AVAILABLE_IN_ALL |
113 | GType gdk_pixbuf_animation_iter_get_type (void) G_GNUC_CONST; |
114 | GDK_PIXBUF_AVAILABLE_IN_ALL |
115 | int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter); |
116 | GDK_PIXBUF_AVAILABLE_IN_ALL |
117 | GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter); |
118 | GDK_PIXBUF_AVAILABLE_IN_ALL |
119 | gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter); |
120 | GDK_PIXBUF_AVAILABLE_IN_ALL |
121 | gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, |
122 | const GTimeVal *current_time); |
123 | |
124 | |
125 | #ifdef GDK_PIXBUF_ENABLE_BACKEND |
126 | |
127 | |
128 | |
129 | /** |
130 | * GdkPixbufAnimationClass: |
131 | * @parent_class: the parent class |
132 | * @is_static_image: returns whether the given animation is just a static image. |
133 | * @get_static_image: returns a static image representing the given animation. |
134 | * @get_size: fills @width and @height with the frame size of the animation. |
135 | * @get_iter: returns an iterator for the given animation. |
136 | * |
137 | * Modules supporting animations must derive a type from |
138 | * #GdkPixbufAnimation, providing suitable implementations of the |
139 | * virtual functions. |
140 | */ |
141 | typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass; |
142 | |
143 | #define GDK_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass)) |
144 | #define GDK_IS_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION)) |
145 | #define GDK_PIXBUF_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass)) |
146 | |
147 | /* Private part of the GdkPixbufAnimation structure */ |
148 | struct _GdkPixbufAnimation { |
149 | GObject parent_instance; |
150 | |
151 | }; |
152 | |
153 | struct _GdkPixbufAnimationClass { |
154 | GObjectClass parent_class; |
155 | |
156 | /*< public >*/ |
157 | |
158 | gboolean (*is_static_image) (GdkPixbufAnimation *anim); |
159 | |
160 | GdkPixbuf* (*get_static_image) (GdkPixbufAnimation *anim); |
161 | |
162 | void (*get_size) (GdkPixbufAnimation *anim, |
163 | int *width, |
164 | int *height); |
165 | |
166 | GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *anim, |
167 | const GTimeVal *start_time); |
168 | |
169 | }; |
170 | |
171 | |
172 | |
173 | /** |
174 | * GdkPixbufAnimationIterClass: |
175 | * @parent_class: the parent class |
176 | * @get_delay_time: returns the time in milliseconds that the current frame |
177 | * should be shown. |
178 | * @get_pixbuf: returns the current frame. |
179 | * @on_currently_loading_frame: returns whether the current frame of @iter is |
180 | * being loaded. |
181 | * @advance: advances the iterator to @current_time, possibly changing the |
182 | * current frame. |
183 | * |
184 | * Modules supporting animations must derive a type from |
185 | * #GdkPixbufAnimationIter, providing suitable implementations of the |
186 | * virtual functions. |
187 | */ |
188 | typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass; |
189 | |
190 | #define GDK_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass)) |
191 | #define GDK_IS_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER)) |
192 | #define GDK_PIXBUF_ANIMATION_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass)) |
193 | |
194 | struct _GdkPixbufAnimationIter { |
195 | GObject parent_instance; |
196 | |
197 | }; |
198 | |
199 | struct _GdkPixbufAnimationIterClass { |
200 | GObjectClass parent_class; |
201 | |
202 | /*< public >*/ |
203 | |
204 | int (*get_delay_time) (GdkPixbufAnimationIter *iter); |
205 | |
206 | GdkPixbuf* (*get_pixbuf) (GdkPixbufAnimationIter *iter); |
207 | |
208 | gboolean (*on_currently_loading_frame) (GdkPixbufAnimationIter *iter); |
209 | |
210 | gboolean (*advance) (GdkPixbufAnimationIter *iter, |
211 | const GTimeVal *current_time); |
212 | }; |
213 | |
214 | |
215 | GDK_PIXBUF_AVAILABLE_IN_ALL |
216 | GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST; |
217 | GDK_PIXBUF_AVAILABLE_IN_ALL |
218 | GdkPixbufAnimation* gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf); |
219 | |
220 | #endif /* GDK_PIXBUF_ENABLE_BACKEND */ |
221 | |
222 | G_END_DECLS |
223 | |
224 | #endif /* GDK_PIXBUF_ANIMATION_H */ |
225 | |