1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gdkpixbuf.PixbufAnimationIter; 26 27 private import gdkpixbuf.Pixbuf; 28 private import gdkpixbuf.c.functions; 29 public import gdkpixbuf.c.types; 30 private import glib.TimeVal; 31 private import gobject.ObjectG; 32 33 34 /** 35 * An opaque object representing an iterator which points to a 36 * certain position in an animation. 37 */ 38 public class PixbufAnimationIter : ObjectG 39 { 40 /** the main Gtk struct */ 41 protected GdkPixbufAnimationIter* gdkPixbufAnimationIter; 42 43 /** Get the main Gtk struct */ 44 public GdkPixbufAnimationIter* getPixbufAnimationIterStruct(bool transferOwnership = false) 45 { 46 if (transferOwnership) 47 ownedRef = false; 48 return gdkPixbufAnimationIter; 49 } 50 51 /** the main Gtk struct as a void* */ 52 protected override void* getStruct() 53 { 54 return cast(void*)gdkPixbufAnimationIter; 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (GdkPixbufAnimationIter* gdkPixbufAnimationIter, bool ownedRef = false) 61 { 62 this.gdkPixbufAnimationIter = gdkPixbufAnimationIter; 63 super(cast(GObject*)gdkPixbufAnimationIter, ownedRef); 64 } 65 66 67 /** */ 68 public static GType getType() 69 { 70 return gdk_pixbuf_animation_iter_get_type(); 71 } 72 73 /** 74 * Possibly advances an animation to a new frame. 75 * 76 * Chooses the frame based on the start time passed to 77 * gdk_pixbuf_animation_get_iter(). 78 * 79 * @current_time would normally come from g_get_current_time(), and 80 * must be greater than or equal to the time passed to 81 * gdk_pixbuf_animation_get_iter(), and must increase or remain 82 * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is 83 * called. That is, you can't go backward in time; animations only 84 * play forward. 85 * 86 * As a shortcut, pass `NULL` for the current time and g_get_current_time() 87 * will be invoked on your behalf. So you only need to explicitly pass 88 * @current_time if you're doing something odd like playing the animation 89 * at double speed. 90 * 91 * If this function returns `FALSE`, there's no need to update the animation 92 * display, assuming the display had been rendered prior to advancing; 93 * if `TRUE`, you need to call gdk_pixbuf_animation_iter_get_pixbuf() 94 * and update the display with the new pixbuf. 95 * 96 * Params: 97 * currentTime = current time 98 * 99 * Returns: `TRUE` if the image may need updating 100 */ 101 public bool advance(TimeVal currentTime) 102 { 103 return gdk_pixbuf_animation_iter_advance(gdkPixbufAnimationIter, (currentTime is null) ? null : currentTime.getTimeValStruct()) != 0; 104 } 105 106 /** 107 * Gets the number of milliseconds the current pixbuf should be displayed, 108 * or -1 if the current pixbuf should be displayed forever. 109 * 110 * The `g_timeout_add()` function conveniently takes a timeout in milliseconds, 111 * so you can use a timeout to schedule the next update. 112 * 113 * Note that some formats, like GIF, might clamp the timeout values in the 114 * image file to avoid updates that are just too quick. The minimum timeout 115 * for GIF images is currently 20 milliseconds. 116 * 117 * Returns: delay time in milliseconds (thousandths of a second) 118 */ 119 public int getDelayTime() 120 { 121 return gdk_pixbuf_animation_iter_get_delay_time(gdkPixbufAnimationIter); 122 } 123 124 /** 125 * Gets the current pixbuf which should be displayed. 126 * 127 * The pixbuf might not be the same size as the animation itself 128 * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()). 129 * 130 * This pixbuf should be displayed for gdk_pixbuf_animation_iter_get_delay_time() 131 * milliseconds. 132 * 133 * The caller of this function does not own a reference to the returned 134 * pixbuf; the returned pixbuf will become invalid when the iterator 135 * advances to the next frame, which may happen anytime you call 136 * gdk_pixbuf_animation_iter_advance(). 137 * 138 * Copy the pixbuf to keep it (don't just add a reference), as it may get 139 * recycled as you advance the iterator. 140 * 141 * Returns: the pixbuf to be displayed 142 */ 143 public Pixbuf getPixbuf() 144 { 145 auto __p = gdk_pixbuf_animation_iter_get_pixbuf(gdkPixbufAnimationIter); 146 147 if(__p is null) 148 { 149 return null; 150 } 151 152 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) __p); 153 } 154 155 /** 156 * Used to determine how to respond to the area_updated signal on 157 * #GdkPixbufLoader when loading an animation. 158 * 159 * The `::area_updated` signal is emitted for an area of the frame currently 160 * streaming in to the loader. So if you're on the currently loading frame, 161 * you will need to redraw the screen for the updated area. 162 * 163 * Returns: `TRUE` if the frame we're on is partially loaded, or the last frame 164 */ 165 public bool onCurrentlyLoadingFrame() 166 { 167 return gdk_pixbuf_animation_iter_on_currently_loading_frame(gdkPixbufAnimationIter) != 0; 168 } 169 }