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