pub struct CVDisplayLink { /* private fields */ }CVDisplayLink only.Expand description
Implementations§
Source§impl CVDisplayLink
impl CVDisplayLink
Sourcepub unsafe fn create_with_cg_displays(
display_array: NonNull<CGDirectDisplayID>,
count: CFIndex,
display_link_out: NonNull<*mut CVDisplayLink>,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVReturn and objc2-core-graphics only.
pub unsafe fn create_with_cg_displays( display_array: NonNull<CGDirectDisplayID>, count: CFIndex, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn
CVReturn and objc2-core-graphics only.General call to create a CVDisplayLink
Use this call to create a CVDisplayLink for a set of displays indentified by the CGDirectDisplayIDs.
Parameter displayArray: array of CGDirectDisplayIDs
Parameter count: number of displays in the displayArray
Parameter displayLinkOut: The new display link will be returned here
Returns: returns kCVReturnSuccess on success.
§Safety
display_arraymust be a valid pointer.display_link_outmust be a valid pointer.
Sourcepub unsafe fn create_with_open_gl_display_mask(
mask: CGOpenGLDisplayMask,
display_link_out: NonNull<*mut CVDisplayLink>,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVReturn and objc2-core-graphics only.
pub unsafe fn create_with_open_gl_display_mask( mask: CGOpenGLDisplayMask, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn
CVReturn and objc2-core-graphics only.Convenience call to create a CVDisplayLink from an OpenGL display mask.
Use this call to create a CVDisplayLink for a CGOpenGLDisplayMask.
Parameter mask: CGOpenGLDisplayMask describing the display
Parameter displayLinkOut: The new display link will be returned here
Returns: returns kCVReturnSuccess on success.
§Safety
display_link_out must be a valid pointer.
Sourcepub unsafe fn create_with_cg_display(
display_id: CGDirectDisplayID,
display_link_out: NonNull<*mut CVDisplayLink>,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVReturn and objc2-core-graphics only.
pub unsafe fn create_with_cg_display( display_id: CGDirectDisplayID, display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn
CVReturn and objc2-core-graphics only.Convenience call to create a CVDisplayLink for a single CGDirectDisplay.
Use this call to create a CVDisplayLink for a single CGDirectDisplay.
Parameter displayID: CGDirectDisplayID of the target display
Parameter displayLinkOut: The new display link will be returned here
Returns: returns kCVReturnSuccess on success.
§Safety
display_link_out must be a valid pointer.
Sourcepub unsafe fn create_with_active_cg_displays(
display_link_out: NonNull<*mut CVDisplayLink>,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVReturn only.
pub unsafe fn create_with_active_cg_displays( display_link_out: NonNull<*mut CVDisplayLink>, ) -> CVReturn
CVReturn only.Convenience function to create a CVDisplayLink capable of being used with all active CGDisplays
Parameter displayLinkOut: The newly created CVDisplayLink
Returns: kCVReturnSuccess if the device was created, or failure
§Safety
display_link_out must be a valid pointer.
Sourcepub fn set_current_cg_display(&self, display_id: CGDirectDisplayID) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVReturn and objc2-core-graphics only.
pub fn set_current_cg_display(&self, display_id: CGDirectDisplayID) -> CVReturn
CVReturn and objc2-core-graphics only.Sets the current display of a DisplayLink
It is safe to call this with a running display link, but be aware that there will likely be a timestamp discontinuity in the video time stamp
Parameter displayLink: target CVDisplayLinkRef
Parameter displayID: target CGDirectDisplayID
Returns: CVReturn. kCVReturnSuccess if successfull.
Sourcepub unsafe fn set_current_cg_display_from_open_gl_context(
&self,
cgl_context: CGLContextObj,
cgl_pixel_format: CGLPixelFormatObj,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVReturn and crate feature objc2-open-gl and macOS only.
pub unsafe fn set_current_cg_display_from_open_gl_context( &self, cgl_context: CGLContextObj, cgl_pixel_format: CGLPixelFormatObj, ) -> CVReturn
CVReturn and crate feature objc2-open-gl and macOS only.Convenience function to select a CVDisplayLink most optimal for the current renderer of the passed in OpenGL context
Parameter displayLink: The CVDisplayLink for which you want to set the current CGDisplay
Parameter cglContext: The OpenGL context to retrieve the current renderer from.
Parameter cglPixelFormat: The OpenGL pixel format used to create the passed in OpenGL context
Returns: kCVReturnSuccess if a device was found, or failure.
§Safety
cgl_contextmust be a valid pointer.cgl_pixel_formatmust be a valid pointer.
Sourcepub fn current_cg_display(&self) -> CGDirectDisplayID
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature objc2-core-graphics only.
pub fn current_cg_display(&self) -> CGDirectDisplayID
objc2-core-graphics only.Gets the current display of a DisplayLink
(description)
Parameter displayLink: target CVDisplayLinkRef
Returns: CGDirectDisplayID
Sourcepub unsafe fn set_output_callback(
&self,
callback: CVDisplayLinkOutputCallback,
user_info: *mut c_void,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVBase and CVReturn only.
pub unsafe fn set_output_callback( &self, callback: CVDisplayLinkOutputCallback, user_info: *mut c_void, ) -> CVReturn
CVBase and CVReturn only.Set the renderer output callback function
The DisplayLink will invoke this callback whenever it wants you to output a frame.
Parameter displayLink: target CVDisplayLinkRef
Parameter callback: CVDisplayLinkOutputCallback function
Parameter userInfo: User data for the callback to identify the context.
Returns: CVReturn. kCVReturnSuccess if successfull.
§Safety
callbackmust be implemented correctly.user_infomust be a valid pointer or null.
Sourcepub unsafe fn set_output_handler(
&self,
handler: CVDisplayLinkOutputHandler,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVBase and CVReturn and block2 only.
pub unsafe fn set_output_handler( &self, handler: CVDisplayLinkOutputHandler, ) -> CVReturn
CVBase and CVReturn and block2 only.Set the renderer output callback block
The DisplayLink will invoke this block whenever it wants you to output a frame. You can only have a block or a callback function; not both.
Parameter displayLink: target CVDisplayLinkRef
Parameter handler: CVDisplayLinkOutputHandler block
Returns: CVReturn. kCVReturnSuccess if successful.
§Safety
handler must be a valid pointer.
Sourcepub fn start(&self) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVReturn only.
pub fn start(&self) -> CVReturn
CVReturn only.Start timer for DisplayLink
This call should not be made from inside the CVDisplayLinkOutputCallback
Parameter displayLink: target CVDisplayLinkRef
Returns: CVReturn. kCVReturnSuccess if successfull. kCVReturnDisplayLinkCallbacksNotSet The DisplayLink cannot be started until the output callback is set.
Sourcepub fn stop(&self) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVReturn only.
pub fn stop(&self) -> CVReturn
CVReturn only.Stop timer for DisplayLink
(description)
Parameter displayLink: target CVDisplayLinkRef
Returns: CVReturn. kCVReturnSuccess if successfull.
Sourcepub fn nominal_output_video_refresh_period(&self) -> CVTime
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVBase only.
pub fn nominal_output_video_refresh_period(&self) -> CVTime
CVBase only.Retrieves the nominal refresh period of a CVDisplayLink.
This call allows one to retrieve the device’s “ideal” refresh period. For example, an NTSC output device might report 1001/60000 to represent the exact NTSC vertial refresh rate.
Parameter displayLink: The CVDisplayLink to get the refresh period from.
Returns: A CVTime struct that holds the nominal refresh period. This value may be indefinite.
Sourcepub fn output_video_latency(&self) -> CVTime
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate feature CVBase only.
pub fn output_video_latency(&self) -> CVTime
CVBase only.Retrieves the nominal latency of a CVDisplayLink.
This call allows one to retrieve the device’s built in output latency. An NTSC device with one frame of latency might report back 1001/30000 or 2002/60000, for example.
Parameter displayLink: The CVDisplayLink to get the latency period from.
Returns: A CVTime struct that holds the latency. This value may be indefinite.
Sourcepub fn actual_output_video_refresh_period(&self) -> c_double
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
pub fn actual_output_video_refresh_period(&self) -> c_double
Retrieves the actual output refresh period of a display as measured by the host timebase.
This call returns the actual output refresh period (in seconds) as computed relative to the host’s timebase.
Parameter displayLink: The CVDisplayLink to get the refresh period from.
Returns: A double containing the actual refresh period. This value may be zero if the device is not running, or is otherwise unavailable.
Sourcepub fn is_running(&self) -> bool
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)
pub fn is_running(&self) -> bool
Retrieves the running state of a CVDisplayLink.
This call queries the running state of the given CVDisplayLink.
Parameter displayLink: The CVDisplayLink to get the running state from.
Returns: A boolean describing the running state. It returns true if it is running and false if it is not running or the CVDisplayLink is invalid.
Sourcepub unsafe fn current_time(&self, out_time: NonNull<CVTimeStamp>) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVBase and CVReturn only.
pub unsafe fn current_time(&self, out_time: NonNull<CVTimeStamp>) -> CVReturn
CVBase and CVReturn only.Retrieves the current (“now”) time of a given CVDisplayLink
This call may be used to get the current time of a running CVDisplayLink, outside of the output callback.
Parameter displayLink: The CVDisplayLink to get the current time from.
Parameter outTime: A pointer to a CVTimeStamp struct. This struct’s version field must currently be set correctly (currently 0) to indicate which version of the timestamp struct is desired.
Returns: kCVReturnSuccess if the current time could be retrieved, otherwise an error indicating why the operation failed.
§Safety
out_time must be a valid pointer.
Sourcepub unsafe fn translate_time(
&self,
in_time: NonNull<CVTimeStamp>,
out_time: NonNull<CVTimeStamp>,
) -> CVReturn
👎Deprecated: use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:)Available on crate features CVBase and CVReturn only.
pub unsafe fn translate_time( &self, in_time: NonNull<CVTimeStamp>, out_time: NonNull<CVTimeStamp>, ) -> CVReturn
CVBase and CVReturn only.Translates the time in the CVDisplayLink’s time base from one representation to another. Note that the device has to be running for this call to succeed.
Parameter displayLink: The CVDisplayLink who’s timebase should be used to do the translation.
Parameter inTime: A CVTimeStamp containing the source time to be translated.
Parameter outTime: A CVTimeStamp into which the target time will be written. This struct’s version field must currently be set correctly
(currently 0) to indicate which version of the timestamp struct is desired. As well, the flags field should be used to specify
which representations to translate to.
Returns: kCVReturnSuccess if the time could be translated, otherwise an error indicating why the operation failed.
§Safety
in_timemust be a valid pointer.out_timemust be a valid pointer.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T.
This is the reference-variant. Use CFRetained::downcast if you
want to convert a retained type. See also ConcreteType for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumbers, small CFStrings etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for CVDisplayLink
impl AsRef<AnyObject> for CVDisplayLink
Source§impl AsRef<CFType> for CVDisplayLink
impl AsRef<CFType> for CVDisplayLink
Source§impl AsRef<CVDisplayLink> for CVDisplayLink
impl AsRef<CVDisplayLink> for CVDisplayLink
Source§impl Borrow<AnyObject> for CVDisplayLink
impl Borrow<AnyObject> for CVDisplayLink
Source§impl Borrow<CFType> for CVDisplayLink
impl Borrow<CFType> for CVDisplayLink
Source§impl ConcreteType for CVDisplayLink
impl ConcreteType for CVDisplayLink
Source§impl Debug for CVDisplayLink
impl Debug for CVDisplayLink
Source§impl Deref for CVDisplayLink
impl Deref for CVDisplayLink
Source§impl Hash for CVDisplayLink
impl Hash for CVDisplayLink
Source§impl Message for CVDisplayLink
impl Message for CVDisplayLink
Source§impl PartialEq for CVDisplayLink
impl PartialEq for CVDisplayLink
Source§impl RefEncode for CVDisplayLink
impl RefEncode for CVDisplayLink
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CVDisplayLink
impl Type for CVDisplayLink
Source§fn retain(&self) -> CFRetained<Self>where
Self: Sized,
fn retain(&self) -> CFRetained<Self>where
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation crate. Read more