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 gdk.FrameTimings;
26 
27 private import gdk.c.functions;
28 public  import gdk.c.types;
29 private import gobject.ObjectG;
30 public  import gtkc.gdktypes;
31 private import gtkd.Loader;
32 
33 
34 /**
35  * A #GdkFrameTimings object holds timing information for a single frame
36  * of the application’s displays. To retrieve #GdkFrameTimings objects,
37  * use gdk_frame_clock_get_timings() or gdk_frame_clock_get_current_timings().
38  * The information in #GdkFrameTimings is useful for precise synchronization
39  * of video with the event or audio streams, and for measuring
40  * quality metrics for the application’s display, such as latency and jitter.
41  */
42 public class FrameTimings
43 {
44 	/** the main Gtk struct */
45 	protected GdkFrameTimings* gdkFrameTimings;
46 	protected bool ownedRef;
47 
48 	/** Get the main Gtk struct */
49 	public GdkFrameTimings* getFrameTimingsStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gdkFrameTimings;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected void* getStruct()
58 	{
59 		return cast(void*)gdkFrameTimings;
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GdkFrameTimings* gdkFrameTimings, bool ownedRef = false)
66 	{
67 		this.gdkFrameTimings = gdkFrameTimings;
68 		this.ownedRef = ownedRef;
69 	}
70 
71 	~this ()
72 	{
73 		if ( Linker.isLoaded(LIBRARY_GDK) && ownedRef )
74 			gdk_frame_timings_unref(gdkFrameTimings);
75 	}
76 
77 
78 	/** */
79 	public static GType getType()
80 	{
81 		return gdk_frame_timings_get_type();
82 	}
83 
84 	/**
85 	 * The timing information in a #GdkFrameTimings is filled in
86 	 * incrementally as the frame as drawn and passed off to the
87 	 * window system for processing and display to the user. The
88 	 * accessor functions for #GdkFrameTimings can return 0 to
89 	 * indicate an unavailable value for two reasons: either because
90 	 * the information is not yet available, or because it isn't
91 	 * available at all. Once gdk_frame_timings_get_complete() returns
92 	 * %TRUE for a frame, you can be certain that no further values
93 	 * will become available and be stored in the #GdkFrameTimings.
94 	 *
95 	 * Returns: %TRUE if all information that will be available
96 	 *     for the frame has been filled in.
97 	 *
98 	 * Since: 3.8
99 	 */
100 	public bool getComplete()
101 	{
102 		return gdk_frame_timings_get_complete(gdkFrameTimings) != 0;
103 	}
104 
105 	/**
106 	 * Gets the frame counter value of the #GdkFrameClock when this
107 	 * this frame was drawn.
108 	 *
109 	 * Returns: the frame counter value for this frame
110 	 *
111 	 * Since: 3.8
112 	 */
113 	public long getFrameCounter()
114 	{
115 		return gdk_frame_timings_get_frame_counter(gdkFrameTimings);
116 	}
117 
118 	/**
119 	 * Returns the frame time for the frame. This is the time value
120 	 * that is typically used to time animations for the frame. See
121 	 * gdk_frame_clock_get_frame_time().
122 	 *
123 	 * Returns: the frame time for the frame, in the timescale
124 	 *     of g_get_monotonic_time()
125 	 */
126 	public long getFrameTime()
127 	{
128 		return gdk_frame_timings_get_frame_time(gdkFrameTimings);
129 	}
130 
131 	/**
132 	 * Gets the predicted time at which this frame will be displayed. Although
133 	 * no predicted time may be available, if one is available, it will
134 	 * be available while the frame is being generated, in contrast to
135 	 * gdk_frame_timings_get_presentation_time(), which is only available
136 	 * after the frame has been presented. In general, if you are simply
137 	 * animating, you should use gdk_frame_clock_get_frame_time() rather
138 	 * than this function, but this function is useful for applications
139 	 * that want exact control over latency. For example, a movie player
140 	 * may want this information for Audio/Video synchronization.
141 	 *
142 	 * Returns: The predicted time at which the frame will be presented,
143 	 *     in the timescale of g_get_monotonic_time(), or 0 if no predicted
144 	 *     presentation time is available.
145 	 *
146 	 * Since: 3.8
147 	 */
148 	public long getPredictedPresentationTime()
149 	{
150 		return gdk_frame_timings_get_predicted_presentation_time(gdkFrameTimings);
151 	}
152 
153 	/**
154 	 * Reurns the presentation time. This is the time at which the frame
155 	 * became visible to the user.
156 	 *
157 	 * Returns: the time the frame was displayed to the user, in the
158 	 *     timescale of g_get_monotonic_time(), or 0 if no presentation
159 	 *     time is available. See gdk_frame_timings_get_complete()
160 	 *
161 	 * Since: 3.8
162 	 */
163 	public long getPresentationTime()
164 	{
165 		return gdk_frame_timings_get_presentation_time(gdkFrameTimings);
166 	}
167 
168 	/**
169 	 * Gets the natural interval between presentation times for
170 	 * the display that this frame was displayed on. Frame presentation
171 	 * usually happens during the “vertical blanking interval”.
172 	 *
173 	 * Returns: the refresh interval of the display, in microseconds,
174 	 *     or 0 if the refresh interval is not available.
175 	 *     See gdk_frame_timings_get_complete().
176 	 *
177 	 * Since: 3.8
178 	 */
179 	public long getRefreshInterval()
180 	{
181 		return gdk_frame_timings_get_refresh_interval(gdkFrameTimings);
182 	}
183 
184 	/**
185 	 * Increases the reference count of @timings.
186 	 *
187 	 * Returns: @timings
188 	 *
189 	 * Since: 3.8
190 	 */
191 	public FrameTimings doref()
192 	{
193 		auto p = gdk_frame_timings_ref(gdkFrameTimings);
194 
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 
200 		return ObjectG.getDObject!(FrameTimings)(cast(GdkFrameTimings*) p, true);
201 	}
202 
203 	/**
204 	 * Decreases the reference count of @timings. If @timings
205 	 * is no longer referenced, it will be freed.
206 	 *
207 	 * Since: 3.8
208 	 */
209 	public void unref()
210 	{
211 		gdk_frame_timings_unref(gdkFrameTimings);
212 	}
213 }