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