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