2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-pixbuf-animation.html
27 * outFile = PixbufAnimation
28 * strct = GdkPixbufAnimation
31 * clss = PixbufAnimation
39 * - gdk_pixbuf_animation_
44 * - gdkpixbuf.PixbufAnimation
48 * - GdkPixbuf* -> Pixbuf
49 * - GdkPixbufAnimation* -> PixbufAnimation
53 module gdkpixbuf
.PixbufAnimation
;
55 private import gdkpixbuf
.gdkpixbuftypes
;
57 private import lib
.gdkpixbuf
;
59 private import gdkpixbuf
.PixbufAnimation
;
60 private import gdk
.Pixbuf
;
61 private import glib
.Str
;
65 * The gdk-pixbuf library provides a simple mechanism to load and represent
66 * animations. An animation is conceptually a series of frames to be displayed
67 * over time. Each frame is the same size. The animation may not be represented
68 * as a series of frames internally; for example, it may be stored as a
69 * sprite and instructions for moving the sprite around a background. To display
70 * an animation you don't need to understand its representation, however; you just
71 * ask gdk-pixbuf what should be displayed at a given point in time.
73 private import gobject
.ObjectG
;
74 public class PixbufAnimation
: ObjectG
77 /** the main Gtk struct */
78 protected GdkPixbufAnimation
* gdkPixbufAnimation
;
81 public GdkPixbufAnimation
* getPixbufAnimationStruct()
83 return gdkPixbufAnimation
;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gdkPixbufAnimation
;
94 * Sets our main struct and passes it to the parent class
96 public this (GdkPixbufAnimation
* gdkPixbufAnimation
)
98 super(cast(GObject
*)gdkPixbufAnimation
);
99 this.gdkPixbufAnimation
= gdkPixbufAnimation
;
108 * Creates a new animation by loading it from a file. The file format is
109 * detected automatically. If the file's format does not support multi-frame
110 * images, then an animation with a single frame will be created. Possible errors
111 * are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains.
113 * Name of file to load, in the GLib file name encoding
115 * return location for error
117 * A newly-created animation with a reference count of 1, or NULL
118 * if any of several error conditions ocurred: the file could not be opened,
119 * there was no loader for the file's format, there was not enough memory to
120 * allocate the image buffer, or the image file contained invalid data.
122 public this (char[] filename
, GError
** error
)
124 // GdkPixbufAnimation* gdk_pixbuf_animation_new_from_file (const char *filename, GError **error);
125 this(cast(GdkPixbufAnimation
*)gdk_pixbuf_animation_new_from_file(Str
.toStringz(filename
), error
) );
130 * gdk_pixbuf_animation_ref is deprecated and should not be used in newly-written code. Use g_object_ref().
131 * Adds a reference to an animation.
135 * The same as the animation argument.
137 public PixbufAnimation
ref()
139 // GdkPixbufAnimation* gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
140 return new PixbufAnimation( gdk_pixbuf_animation_ref(gdkPixbufAnimation
) );
145 * gdk_pixbuf_animation_unref is deprecated and should not be used in newly-written code. Use g_object_unref().
146 * Removes a reference from an animation.
152 // void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
153 gdk_pixbuf_animation_unref(gdkPixbufAnimation
);
157 * Queries the width of the bounding box of a pixbuf animation.
161 * Width of the bounding box of the animation.
163 public int getWidth()
165 // int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
166 return gdk_pixbuf_animation_get_width(gdkPixbufAnimation
);
170 * Queries the height of the bounding box of a pixbuf animation.
174 * Height of the bounding box of the animation.
176 public int getHeight()
178 // int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
179 return gdk_pixbuf_animation_get_height(gdkPixbufAnimation
);
183 * Get an iterator for displaying an animation. The iterator provides
184 * the frames that should be displayed at a given time.
185 * It should be freed after use with g_object_unref().
186 * start_time would normally come from g_get_current_time(), and
187 * marks the beginning of animation playback. After creating an
188 * iterator, you should immediately display the pixbuf returned by
189 * gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a
190 * timeout (with g_timeout_add()) or by some other mechanism ensure
191 * that you'll update the image after
192 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
193 * the image is updated, you should reinstall the timeout with the new,
194 * possibly-changed delay time.
195 * As a shortcut, if start_time is NULL, the result of
196 * g_get_current_time() will be used automatically.
197 * To update the image (i.e. possibly change the result of
198 * gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
199 * call gdk_pixbuf_animation_iter_advance().
200 * If you're using GdkPixbufLoader, in addition to updating the image
201 * after the delay time, you should also update it whenever you
202 * receive the area_updated signal and
203 * gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
204 * TRUE. In this case, the frame currently being fed into the loader
205 * has received new data, so needs to be refreshed. The delay time for
206 * a frame may also be modified after an area_updated signal, for
207 * example if the delay time for a frame is encoded in the data after
208 * the frame itself. So your timeout should be reinstalled after any
209 * area_updated signal.
210 * A delay time of -1 is possible, indicating "infinite."
212 * a GdkPixbufAnimation
214 * time when the animation starts playing
216 * an iterator to move over the animation
218 public GdkPixbufAnimationIter
* getIter(GTimeVal
* startTime
)
220 // GdkPixbufAnimationIter* gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation, const GTimeVal *start_time);
221 return gdk_pixbuf_animation_get_iter(gdkPixbufAnimation
, startTime
);
225 * If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
226 * out to be a plain, unanimated image, then this function will return
227 * TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
230 * a GdkPixbufAnimation
232 * TRUE if the "animation" was really just an image
234 public int isStaticImage()
236 // gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
237 return gdk_pixbuf_animation_is_static_image(gdkPixbufAnimation
);
241 * If an animation is really just a plain image (has only one frame),
242 * this function returns that image. If the animation is an animation,
243 * this function returns a reasonable thing to display as a static
244 * unanimated image, which might be the first frame, or something more
245 * sophisticated. If an animation hasn't loaded any frames yet, this
246 * function will return NULL.
248 * a GdkPixbufAnimation
250 * unanimated image representing the animation
252 public Pixbuf
getStaticImage()
254 // GdkPixbuf* gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
255 return new Pixbuf( gdk_pixbuf_animation_get_static_image(gdkPixbufAnimation
) );
259 * Possibly advances an animation to a new frame. Chooses the frame based
260 * on the start time passed to gdk_pixbuf_animation_get_iter().
261 * current_time would normally come from g_get_current_time(), and
262 * must be greater than or equal to the time passed to
263 * gdk_pixbuf_animation_get_iter(), and must increase or remain
264 * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
265 * called. That is, you can't go backward in time; animations only
267 * As a shortcut, pass NULL for the current time and g_get_current_time()
268 * will be invoked on your behalf. So you only need to explicitly pass
269 * current_time if you're doing something odd like playing the animation
271 * If this function returns FALSE, there's no need to update the animation
272 * display, assuming the display had been rendered prior to advancing;
273 * if TRUE, you need to call gdk_animation_iter_get_pixbuf() and update the
274 * display with the new pixbuf.
276 * a GdkPixbufAnimationIter
280 * TRUE if the image may need updating
282 public static int iterAdvance(GdkPixbufAnimationIter
* iter
, GTimeVal
* currentTime
)
284 // gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, const GTimeVal *current_time);
285 return gdk_pixbuf_animation_iter_advance(iter
, currentTime
);
289 * Gets the number of milliseconds the current pixbuf should be displayed,
290 * or -1 if the current pixbuf should be displayed forever. g_timeout_add()
291 * conveniently takes a timeout in milliseconds, so you can use a timeout
292 * to schedule the next update.
294 * an animation iterator
296 * delay time in milliseconds (thousandths of a second)
298 public static int iterGetDelayTime(GdkPixbufAnimationIter
* iter
)
300 // int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
301 return gdk_pixbuf_animation_iter_get_delay_time(iter
);
305 * Used to determine how to respond to the area_updated signal on
306 * GdkPixbufLoader when loading an animation. area_updated is emitted
307 * for an area of the frame currently streaming in to the loader. So if
308 * you're on the currently loading frame, you need to redraw the screen for
311 * a GdkPixbufAnimationIter
313 * TRUE if the frame we're on is partially loaded, or the last frame
315 public static int iterOnCurrentlyLoadingFrame(GdkPixbufAnimationIter
* iter
)
317 // gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
318 return gdk_pixbuf_animation_iter_on_currently_loading_frame(iter
);
322 * Gets the current pixbuf which should be displayed; the pixbuf will
323 * be the same size as the animation itself
324 * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
325 * This pixbuf should be displayed for
326 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
327 * of this function does not own a reference to the returned pixbuf;
328 * the returned pixbuf will become invalid when the iterator advances
329 * to the next frame, which may happen anytime you call
330 * gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
331 * (don't just add a reference), as it may get recycled as you advance
334 * an animation iterator
336 * the pixbuf to be displayed
338 public static Pixbuf
iterGetPixbuf(GdkPixbufAnimationIter
* iter
)
340 // GdkPixbuf* gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
341 return new Pixbuf( gdk_pixbuf_animation_iter_get_pixbuf(iter
) );
346 * Creates a new, empty animation.
348 * the width of the animation
350 * the height of the animation
352 * the speed of the animation, in frames per second
354 * a newly allocated GdkPixbufSimpleAnim
357 public static GdkPixbufSimpleAnim
* gdkPixbufSimpleAnimNew(int width
, int height
, float rate
)
359 // GdkPixbufSimpleAnim* gdk_pixbuf_simple_anim_new (gint width, gint height, gfloat rate);
360 return gdk_pixbuf_simple_anim_new(width
, height
, rate
);
364 * Adds a new frame to animation. The pixbuf must
365 * have the dimensions specified when the animation
368 * a GdkPixbufSimpleAnim
375 public static void gdkPixbufSimpleAnimAddFrame(GdkPixbufSimpleAnim
* animation
, Pixbuf pixbuf
)
377 // void gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation, GdkPixbuf *pixbuf);
378 gdk_pixbuf_simple_anim_add_frame(animation
, (pixbuf
is null) ?
null : pixbuf
.getPixbufStruct());