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

source code of gtk/subprojects/gdk-pixbuf/gdk-pixbuf/gdk-pixbuf-animation.h