objc2_quartz_core/generated/
CAMetalLayer.rs1use 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-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11#[cfg(feature = "objc2-metal")]
12use objc2_metal::*;
13
14use crate::*;
15
16extern_protocol!(
17 #[cfg(feature = "objc2-metal")]
19 pub unsafe trait CAMetalDrawable: MTLDrawable {
20 #[unsafe(method(texture))]
21 #[unsafe(method_family = none)]
22 fn texture(&self) -> Retained<ProtocolObject<dyn MTLTexture>>;
23
24 #[cfg(feature = "CALayer")]
25 #[unsafe(method(layer))]
26 #[unsafe(method_family = none)]
27 fn layer(&self) -> Retained<CAMetalLayer>;
28 }
29);
30
31extern_class!(
32 #[unsafe(super(CALayer, NSObject))]
34 #[derive(Debug, PartialEq, Eq, Hash)]
35 #[cfg(feature = "CALayer")]
36 pub struct CAMetalLayer;
37);
38
39#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
40extern_conformance!(
41 unsafe impl CAMediaTiming for CAMetalLayer {}
42);
43
44#[cfg(feature = "CALayer")]
45extern_conformance!(
46 unsafe impl NSCoding for CAMetalLayer {}
47);
48
49#[cfg(feature = "CALayer")]
50extern_conformance!(
51 unsafe impl NSObjectProtocol for CAMetalLayer {}
52);
53
54#[cfg(feature = "CALayer")]
55extern_conformance!(
56 unsafe impl NSSecureCoding for CAMetalLayer {}
57);
58
59#[cfg(feature = "CALayer")]
60impl CAMetalLayer {
61 extern_methods!(
62 #[cfg(feature = "objc2-metal")]
63 #[unsafe(method(device))]
64 #[unsafe(method_family = none)]
65 pub fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
66
67 #[cfg(feature = "objc2-metal")]
68 #[unsafe(method(setDevice:))]
70 #[unsafe(method_family = none)]
71 pub fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);
72
73 #[cfg(feature = "objc2-metal")]
74 #[unsafe(method(preferredDevice))]
75 #[unsafe(method_family = none)]
76 pub fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
77
78 #[cfg(feature = "objc2-metal")]
79 #[unsafe(method(pixelFormat))]
80 #[unsafe(method_family = none)]
81 pub fn pixelFormat(&self) -> MTLPixelFormat;
82
83 #[cfg(feature = "objc2-metal")]
84 #[unsafe(method(setPixelFormat:))]
86 #[unsafe(method_family = none)]
87 pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
88
89 #[unsafe(method(framebufferOnly))]
90 #[unsafe(method_family = none)]
91 pub fn framebufferOnly(&self) -> bool;
92
93 #[unsafe(method(setFramebufferOnly:))]
95 #[unsafe(method_family = none)]
96 pub fn setFramebufferOnly(&self, framebuffer_only: bool);
97
98 #[cfg(feature = "objc2-core-foundation")]
99 #[unsafe(method(drawableSize))]
100 #[unsafe(method_family = none)]
101 pub fn drawableSize(&self) -> CGSize;
102
103 #[cfg(feature = "objc2-core-foundation")]
104 #[unsafe(method(setDrawableSize:))]
106 #[unsafe(method_family = none)]
107 pub fn setDrawableSize(&self, drawable_size: CGSize);
108
109 #[cfg(feature = "objc2-metal")]
110 #[unsafe(method(nextDrawable))]
111 #[unsafe(method_family = none)]
112 pub fn nextDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;
113
114 #[unsafe(method(maximumDrawableCount))]
115 #[unsafe(method_family = none)]
116 pub fn maximumDrawableCount(&self) -> NSUInteger;
117
118 #[unsafe(method(setMaximumDrawableCount:))]
120 #[unsafe(method_family = none)]
121 pub fn setMaximumDrawableCount(&self, maximum_drawable_count: NSUInteger);
122
123 #[unsafe(method(presentsWithTransaction))]
124 #[unsafe(method_family = none)]
125 pub fn presentsWithTransaction(&self) -> bool;
126
127 #[unsafe(method(setPresentsWithTransaction:))]
129 #[unsafe(method_family = none)]
130 pub fn setPresentsWithTransaction(&self, presents_with_transaction: bool);
131
132 #[cfg(feature = "objc2-core-graphics")]
133 #[unsafe(method(colorspace))]
134 #[unsafe(method_family = none)]
135 pub fn colorspace(&self) -> Option<Retained<CGColorSpace>>;
136
137 #[cfg(feature = "objc2-core-graphics")]
138 #[unsafe(method(setColorspace:))]
140 #[unsafe(method_family = none)]
141 pub fn setColorspace(&self, colorspace: Option<&CGColorSpace>);
142
143 #[unsafe(method(wantsExtendedDynamicRangeContent))]
144 #[unsafe(method_family = none)]
145 pub fn wantsExtendedDynamicRangeContent(&self) -> bool;
146
147 #[unsafe(method(setWantsExtendedDynamicRangeContent:))]
149 #[unsafe(method_family = none)]
150 pub fn setWantsExtendedDynamicRangeContent(
151 &self,
152 wants_extended_dynamic_range_content: bool,
153 );
154
155 #[cfg(feature = "CAEDRMetadata")]
156 #[unsafe(method(EDRMetadata))]
157 #[unsafe(method_family = none)]
158 pub fn EDRMetadata(&self) -> Option<Retained<CAEDRMetadata>>;
159
160 #[cfg(feature = "CAEDRMetadata")]
161 #[unsafe(method(setEDRMetadata:))]
163 #[unsafe(method_family = none)]
164 pub fn setEDRMetadata(&self, edr_metadata: Option<&CAEDRMetadata>);
165
166 #[unsafe(method(displaySyncEnabled))]
167 #[unsafe(method_family = none)]
168 pub fn displaySyncEnabled(&self) -> bool;
169
170 #[unsafe(method(setDisplaySyncEnabled:))]
172 #[unsafe(method_family = none)]
173 pub fn setDisplaySyncEnabled(&self, display_sync_enabled: bool);
174
175 #[unsafe(method(allowsNextDrawableTimeout))]
176 #[unsafe(method_family = none)]
177 pub fn allowsNextDrawableTimeout(&self) -> bool;
178
179 #[unsafe(method(setAllowsNextDrawableTimeout:))]
181 #[unsafe(method_family = none)]
182 pub fn setAllowsNextDrawableTimeout(&self, allows_next_drawable_timeout: bool);
183
184 #[unsafe(method(developerHUDProperties))]
185 #[unsafe(method_family = none)]
186 pub fn developerHUDProperties(&self) -> Option<Retained<NSDictionary>>;
187
188 #[unsafe(method(setDeveloperHUDProperties:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn setDeveloperHUDProperties(
198 &self,
199 developer_hud_properties: Option<&NSDictionary>,
200 );
201
202 #[cfg(feature = "objc2-metal")]
203 #[unsafe(method(residencySet))]
204 #[unsafe(method_family = none)]
205 pub fn residencySet(&self) -> Retained<ProtocolObject<dyn MTLResidencySet>>;
206 );
207}
208
209#[cfg(feature = "CALayer")]
211impl CAMetalLayer {
212 extern_methods!(
213 #[unsafe(method(layer))]
215 #[unsafe(method_family = none)]
216 pub fn layer() -> Retained<Self>;
217
218 #[unsafe(method(init))]
219 #[unsafe(method_family = init)]
220 pub fn init(this: Allocated<Self>) -> Retained<Self>;
221
222 #[unsafe(method(initWithLayer:))]
226 #[unsafe(method_family = init)]
227 pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
228 );
229}
230
231#[cfg(feature = "CALayer")]
233impl CAMetalLayer {
234 extern_methods!(
235 #[unsafe(method(new))]
236 #[unsafe(method_family = new)]
237 pub fn new() -> Retained<Self>;
238 );
239}
240
241#[cfg(feature = "CALayer")]
242impl DefaultRetained for CAMetalLayer {
243 #[inline]
244 fn default_retained() -> Retained<Self> {
245 Self::new()
246 }
247}