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