objc2_core_graphics/generated/
CGDisplayFade.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4
5use crate::*;
6
7/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgdisplayfadereservationinvalidtoken?language=objc)
8pub const kCGDisplayFadeReservationInvalidToken: c_uint = 0;
9/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgdisplayblendnormal?language=objc)
10pub const kCGDisplayBlendNormal: c_float = 0.0;
11/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgdisplayblendsolidcolor?language=objc)
12pub const kCGDisplayBlendSolidColor: c_float = 1.0;
13/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgmaxdisplayreservationinterval?language=objc)
14pub const kCGMaxDisplayReservationInterval: CGDisplayReservationInterval = 15.0;
15/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgdisplayfadereservationtoken?language=objc)
16pub type CGDisplayFadeReservationToken = u32;
17
18/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgdisplayblendfraction?language=objc)
19pub type CGDisplayBlendFraction = c_float;
20
21/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgdisplayfadeinterval?language=objc)
22pub type CGDisplayFadeInterval = c_float;
23
24extern "C-unwind" {
25    /// # Safety
26    ///
27    /// `config` must be a valid pointer or null.
28    #[cfg(all(feature = "CGDisplayConfiguration", feature = "CGError"))]
29    pub fn CGConfigureDisplayFadeEffect(
30        config: CGDisplayConfigRef,
31        fade_out_seconds: CGDisplayFadeInterval,
32        fade_in_seconds: CGDisplayFadeInterval,
33        fade_red: c_float,
34        fade_green: c_float,
35        fade_blue: c_float,
36    ) -> CGError;
37}
38
39/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgdisplayreservationinterval?language=objc)
40pub type CGDisplayReservationInterval = c_float;
41
42extern "C-unwind" {
43    /// # Safety
44    ///
45    /// `token` must be a valid pointer or null.
46    #[cfg(feature = "CGError")]
47    pub fn CGAcquireDisplayFadeReservation(
48        seconds: CGDisplayReservationInterval,
49        token: *mut CGDisplayFadeReservationToken,
50    ) -> CGError;
51}
52
53#[cfg(feature = "CGError")]
54#[inline]
55pub extern "C-unwind" fn CGReleaseDisplayFadeReservation(
56    token: CGDisplayFadeReservationToken,
57) -> CGError {
58    extern "C-unwind" {
59        fn CGReleaseDisplayFadeReservation(token: CGDisplayFadeReservationToken) -> CGError;
60    }
61    unsafe { CGReleaseDisplayFadeReservation(token) }
62}
63
64#[cfg(all(feature = "CGError", feature = "libc"))]
65#[inline]
66pub extern "C-unwind" fn CGDisplayFade(
67    token: CGDisplayFadeReservationToken,
68    duration: CGDisplayFadeInterval,
69    start_blend: CGDisplayBlendFraction,
70    end_blend: CGDisplayBlendFraction,
71    red_blend: c_float,
72    green_blend: c_float,
73    blue_blend: c_float,
74    synchronous: bool,
75) -> CGError {
76    extern "C-unwind" {
77        fn CGDisplayFade(
78            token: CGDisplayFadeReservationToken,
79            duration: CGDisplayFadeInterval,
80            start_blend: CGDisplayBlendFraction,
81            end_blend: CGDisplayBlendFraction,
82            red_blend: c_float,
83            green_blend: c_float,
84            blue_blend: c_float,
85            synchronous: libc::boolean_t,
86        ) -> CGError;
87    }
88    unsafe {
89        CGDisplayFade(
90            token,
91            duration,
92            start_blend,
93            end_blend,
94            red_blend,
95            green_blend,
96            blue_blend,
97            synchronous as _,
98        )
99    }
100}
101
102#[cfg(feature = "libc")]
103#[deprecated = "No longer supported"]
104#[inline]
105pub extern "C-unwind" fn CGDisplayFadeOperationInProgress() -> bool {
106    extern "C-unwind" {
107        fn CGDisplayFadeOperationInProgress() -> libc::boolean_t;
108    }
109    let ret = unsafe { CGDisplayFadeOperationInProgress() };
110    ret != 0
111}