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 glib.TimeVal; 29 private import gobject.ObjectG; 30 private import gtkc.gdkpixbuf; 31 public import gtkc.gdkpixbuftypes; 32 33 34 /** 35 * An opaque struct 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 protected override void setStruct(GObject* obj) 58 { 59 gdkPixbufAnimationIter = cast(GdkPixbufAnimationIter*)obj; 60 super.setStruct(obj); 61 } 62 63 /** 64 * Sets our main struct and passes it to the parent class. 65 */ 66 public this (GdkPixbufAnimationIter* gdkPixbufAnimationIter, bool ownedRef = false) 67 { 68 this.gdkPixbufAnimationIter = gdkPixbufAnimationIter; 69 super(cast(GObject*)gdkPixbufAnimationIter, ownedRef); 70 } 71 72 73 /** */ 74 public static GType getType() 75 { 76 return gdk_pixbuf_animation_iter_get_type(); 77 } 78 79 /** 80 * Possibly advances an animation to a new frame. Chooses the frame based 81 * on the start time passed to gdk_pixbuf_animation_get_iter(). 82 * 83 * @current_time would normally come from g_get_current_time(), and 84 * must be greater than or equal to the time passed to 85 * gdk_pixbuf_animation_get_iter(), and must increase or remain 86 * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is 87 * called. That is, you can't go backward in time; animations only 88 * play forward. 89 * 90 * As a shortcut, pass %NULL for the current time and g_get_current_time() 91 * will be invoked on your behalf. So you only need to explicitly pass 92 * @current_time if you're doing something odd like playing the animation 93 * at double speed. 94 * 95 * If this function returns %FALSE, there's no need to update the animation 96 * display, assuming the display had been rendered prior to advancing; 97 * if %TRUE, you need to call gdk_pixbuf_animation_iter_get_pixbuf() 98 * and update the display with the new pixbuf. 99 * 100 * Params: 101 * currentTime = current time 102 * 103 * Returns: %TRUE if the image may need updating 104 */ 105 public bool advance(TimeVal currentTime) 106 { 107 return gdk_pixbuf_animation_iter_advance(gdkPixbufAnimationIter, (currentTime is null) ? null : currentTime.getTimeValStruct()) != 0; 108 } 109 110 /** 111 * Gets the number of milliseconds the current pixbuf should be displayed, 112 * or -1 if the current pixbuf should be displayed forever. g_timeout_add() 113 * conveniently takes a timeout in milliseconds, so you can use a timeout 114 * to schedule the next update. 115 * 116 * Note that some formats, like GIF, might clamp the timeout values in the 117 * image file to avoid updates that are just too quick. The minimum timeout 118 * for GIF images is currently 20 milliseconds. 119 * 120 * Returns: delay time in milliseconds (thousandths of a second) 121 */ 122 public int getDelayTime() 123 { 124 return gdk_pixbuf_animation_iter_get_delay_time(gdkPixbufAnimationIter); 125 } 126 127 /** 128 * Gets the current pixbuf which should be displayed; the pixbuf might not 129 * be the same size as the animation itself 130 * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()). 131 * This pixbuf should be displayed for 132 * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller 133 * of this function does not own a reference to the returned pixbuf; 134 * the returned pixbuf will become invalid when the iterator advances 135 * to the next frame, which may happen anytime you call 136 * gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it 137 * (don't just add a reference), as it may get recycled as you advance 138 * the iterator. 139 * 140 * Returns: the pixbuf to be displayed 141 */ 142 public Pixbuf getPixbuf() 143 { 144 auto p = gdk_pixbuf_animation_iter_get_pixbuf(gdkPixbufAnimationIter); 145 146 if(p is null) 147 { 148 return null; 149 } 150 151 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 152 } 153 154 /** 155 * Used to determine how to respond to the area_updated signal on 156 * #GdkPixbufLoader when loading an animation. area_updated is emitted 157 * for an area of the frame currently streaming in to the loader. So if 158 * you're on the currently loading frame, you need to redraw the screen for 159 * the updated area. 160 * 161 * Returns: %TRUE if the frame we're on is partially loaded, or the last frame 162 */ 163 public bool onCurrentlyLoadingFrame() 164 { 165 return gdk_pixbuf_animation_iter_on_currently_loading_frame(gdkPixbufAnimationIter) != 0; 166 } 167 }