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