objc2_quartz_core/generated/
CARenderer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-video")]
9use objc2_core_video::*;
10use objc2_foundation::*;
11#[cfg(feature = "objc2-metal")]
12use objc2_metal::*;
13
14use crate::*;
15
16extern_class!(
17    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/carenderer?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    pub struct CARenderer;
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for CARenderer {}
25);
26
27impl CARenderer {
28    extern_methods!(
29        /// # Safety
30        ///
31        /// - `ctx` must be a valid pointer.
32        /// - `dict` generic should be of the correct type.
33        #[deprecated = "OpenGL is deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings)"]
34        #[unsafe(method(rendererWithCGLContext:options:))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn rendererWithCGLContext_options(
37            ctx: NonNull<c_void>,
38            dict: Option<&NSDictionary>,
39        ) -> Retained<CARenderer>;
40
41        #[cfg(feature = "objc2-metal")]
42        /// # Safety
43        ///
44        /// - `tex` may need to be synchronized.
45        /// - `tex` may be unretained, you must ensure it is kept alive while in use.
46        /// - `dict` generic should be of the correct type.
47        #[unsafe(method(rendererWithMTLTexture:options:))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn rendererWithMTLTexture_options(
50            tex: &ProtocolObject<dyn MTLTexture>,
51            dict: Option<&NSDictionary>,
52        ) -> Retained<CARenderer>;
53
54        #[cfg(feature = "CALayer")]
55        #[unsafe(method(layer))]
56        #[unsafe(method_family = none)]
57        pub fn layer(&self) -> Option<Retained<CALayer>>;
58
59        #[cfg(feature = "CALayer")]
60        /// Setter for [`layer`][Self::layer].
61        #[unsafe(method(setLayer:))]
62        #[unsafe(method_family = none)]
63        pub fn setLayer(&self, layer: Option<&CALayer>);
64
65        #[cfg(feature = "objc2-core-foundation")]
66        #[unsafe(method(bounds))]
67        #[unsafe(method_family = none)]
68        pub fn bounds(&self) -> CGRect;
69
70        #[cfg(feature = "objc2-core-foundation")]
71        /// Setter for [`bounds`][Self::bounds].
72        #[unsafe(method(setBounds:))]
73        #[unsafe(method_family = none)]
74        pub fn setBounds(&self, bounds: CGRect);
75
76        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-video"))]
77        /// # Safety
78        ///
79        /// `ts` must be a valid pointer or null.
80        #[unsafe(method(beginFrameAtTime:timeStamp:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn beginFrameAtTime_timeStamp(&self, t: CFTimeInterval, ts: *mut CVTimeStamp);
83
84        #[cfg(feature = "objc2-core-foundation")]
85        #[unsafe(method(updateBounds))]
86        #[unsafe(method_family = none)]
87        pub fn updateBounds(&self) -> CGRect;
88
89        #[cfg(feature = "objc2-core-foundation")]
90        #[unsafe(method(addUpdateRect:))]
91        #[unsafe(method_family = none)]
92        pub fn addUpdateRect(&self, r: CGRect);
93
94        #[unsafe(method(render))]
95        #[unsafe(method_family = none)]
96        pub fn render(&self);
97
98        #[cfg(feature = "objc2-core-foundation")]
99        #[unsafe(method(nextFrameTime))]
100        #[unsafe(method_family = none)]
101        pub fn nextFrameTime(&self) -> CFTimeInterval;
102
103        #[unsafe(method(endFrame))]
104        #[unsafe(method_family = none)]
105        pub fn endFrame(&self);
106
107        #[cfg(feature = "objc2-metal")]
108        /// # Safety
109        ///
110        /// - `tex` may need to be synchronized.
111        /// - `tex` may be unretained, you must ensure it is kept alive while in use.
112        #[unsafe(method(setDestination:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setDestination(&self, tex: &ProtocolObject<dyn MTLTexture>);
115    );
116}
117
118/// Methods declared on superclass `NSObject`.
119impl CARenderer {
120    extern_methods!(
121        #[unsafe(method(init))]
122        #[unsafe(method_family = init)]
123        pub fn init(this: Allocated<Self>) -> Retained<Self>;
124
125        #[unsafe(method(new))]
126        #[unsafe(method_family = new)]
127        pub fn new() -> Retained<Self>;
128    );
129}
130
131impl DefaultRetained for CARenderer {
132    #[inline]
133    fn default_retained() -> Retained<Self> {
134        Self::new()
135    }
136}
137
138extern "C" {
139    /// Options for the renderer options dictionary. *
140    ///
141    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcarenderercolorspace?language=objc)
142    pub static kCARendererColorSpace: &'static NSString;
143}
144
145extern "C" {
146    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcarenderermetalcommandqueue?language=objc)
147    pub static kCARendererMetalCommandQueue: &'static NSString;
148}