objc2_ui_kit/generated/
UIGraphicsImageRenderer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[cfg(all(feature = "UIGraphicsRenderer", feature = "block2"))]
14pub type UIGraphicsImageDrawingActions =
15 *mut block2::Block<dyn Fn(NonNull<UIGraphicsImageRendererContext>)>;
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct UIGraphicsImageRendererFormatRange(pub NSInteger);
22impl UIGraphicsImageRendererFormatRange {
23 #[doc(alias = "UIGraphicsImageRendererFormatRangeUnspecified")]
24 pub const Unspecified: Self = Self(-1);
25 #[doc(alias = "UIGraphicsImageRendererFormatRangeAutomatic")]
26 pub const Automatic: Self = Self(0);
27 #[doc(alias = "UIGraphicsImageRendererFormatRangeExtended")]
28 pub const Extended: Self = Self(1);
29 #[doc(alias = "UIGraphicsImageRendererFormatRangeStandard")]
30 pub const Standard: Self = Self(2);
31}
32
33unsafe impl Encode for UIGraphicsImageRendererFormatRange {
34 const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for UIGraphicsImageRendererFormatRange {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_class!(
42 #[unsafe(super(UIGraphicsRendererFormat, NSObject))]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 #[cfg(feature = "UIGraphicsRenderer")]
46 pub struct UIGraphicsImageRendererFormat;
47);
48
49#[cfg(feature = "UIGraphicsRenderer")]
50unsafe impl NSCopying for UIGraphicsImageRendererFormat {}
51
52#[cfg(feature = "UIGraphicsRenderer")]
53unsafe impl CopyingHelper for UIGraphicsImageRendererFormat {
54 type Result = Self;
55}
56
57#[cfg(feature = "UIGraphicsRenderer")]
58unsafe impl NSObjectProtocol for UIGraphicsImageRendererFormat {}
59
60#[cfg(feature = "UIGraphicsRenderer")]
61impl UIGraphicsImageRendererFormat {
62 extern_methods!(
63 #[cfg(feature = "objc2-core-foundation")]
64 #[unsafe(method(scale))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn scale(&self) -> CGFloat;
67
68 #[cfg(feature = "objc2-core-foundation")]
69 #[unsafe(method(setScale:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn setScale(&self, scale: CGFloat);
73
74 #[unsafe(method(opaque))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn opaque(&self) -> bool;
77
78 #[unsafe(method(setOpaque:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn setOpaque(&self, opaque: bool);
82
83 #[deprecated = "Use the preferredRange property instead"]
84 #[unsafe(method(prefersExtendedRange))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn prefersExtendedRange(&self) -> bool;
87
88 #[deprecated = "Use the preferredRange property instead"]
90 #[unsafe(method(setPrefersExtendedRange:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn setPrefersExtendedRange(&self, prefers_extended_range: bool);
93
94 #[unsafe(method(supportsHighDynamicRange))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn supportsHighDynamicRange(&self) -> bool;
97
98 #[unsafe(method(preferredRange))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn preferredRange(&self) -> UIGraphicsImageRendererFormatRange;
102
103 #[unsafe(method(setPreferredRange:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setPreferredRange(&self, preferred_range: UIGraphicsImageRendererFormatRange);
107
108 #[cfg(feature = "UITraitCollection")]
109 #[unsafe(method(formatForTraitCollection:))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn formatForTraitCollection(
112 trait_collection: &UITraitCollection,
113 ) -> Retained<Self>;
114 );
115}
116
117#[cfg(feature = "UIGraphicsRenderer")]
119impl UIGraphicsImageRendererFormat {
120 extern_methods!(
121 #[deprecated]
122 #[unsafe(method(defaultFormat))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn defaultFormat() -> Retained<Self>;
125
126 #[unsafe(method(preferredFormat))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn preferredFormat() -> Retained<Self>;
129 );
130}
131
132#[cfg(feature = "UIGraphicsRenderer")]
134impl UIGraphicsImageRendererFormat {
135 extern_methods!(
136 #[unsafe(method(init))]
137 #[unsafe(method_family = init)]
138 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140 #[unsafe(method(new))]
141 #[unsafe(method_family = new)]
142 pub unsafe fn new() -> Retained<Self>;
143 );
144}
145
146extern_class!(
147 #[unsafe(super(UIGraphicsRendererContext, NSObject))]
149 #[derive(Debug, PartialEq, Eq, Hash)]
150 #[cfg(feature = "UIGraphicsRenderer")]
151 pub struct UIGraphicsImageRendererContext;
152);
153
154#[cfg(feature = "UIGraphicsRenderer")]
155unsafe impl NSObjectProtocol for UIGraphicsImageRendererContext {}
156
157#[cfg(feature = "UIGraphicsRenderer")]
158impl UIGraphicsImageRendererContext {
159 extern_methods!(
160 #[cfg(feature = "UIImage")]
161 #[unsafe(method(currentImage))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn currentImage(&self) -> Retained<UIImage>;
164 );
165}
166
167#[cfg(feature = "UIGraphicsRenderer")]
169impl UIGraphicsImageRendererContext {
170 extern_methods!(
171 #[unsafe(method(init))]
172 #[unsafe(method_family = init)]
173 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174
175 #[unsafe(method(new))]
176 #[unsafe(method_family = new)]
177 pub unsafe fn new() -> Retained<Self>;
178 );
179}
180
181extern_class!(
182 #[unsafe(super(UIGraphicsRenderer, NSObject))]
184 #[derive(Debug, PartialEq, Eq, Hash)]
185 #[cfg(feature = "UIGraphicsRenderer")]
186 pub struct UIGraphicsImageRenderer;
187);
188
189#[cfg(feature = "UIGraphicsRenderer")]
190unsafe impl NSObjectProtocol for UIGraphicsImageRenderer {}
191
192#[cfg(feature = "UIGraphicsRenderer")]
193impl UIGraphicsImageRenderer {
194 extern_methods!(
195 #[cfg(feature = "objc2-core-foundation")]
196 #[unsafe(method(initWithSize:))]
197 #[unsafe(method_family = init)]
198 pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
199
200 #[cfg(feature = "objc2-core-foundation")]
201 #[unsafe(method(initWithSize:format:))]
202 #[unsafe(method_family = init)]
203 pub unsafe fn initWithSize_format(
204 this: Allocated<Self>,
205 size: CGSize,
206 format: &UIGraphicsImageRendererFormat,
207 ) -> Retained<Self>;
208
209 #[cfg(feature = "objc2-core-foundation")]
210 #[unsafe(method(initWithBounds:format:))]
211 #[unsafe(method_family = init)]
212 pub unsafe fn initWithBounds_format(
213 this: Allocated<Self>,
214 bounds: CGRect,
215 format: &UIGraphicsImageRendererFormat,
216 ) -> Retained<Self>;
217
218 #[cfg(all(feature = "UIImage", feature = "block2"))]
219 #[unsafe(method(imageWithActions:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn imageWithActions(
222 &self,
223 actions: UIGraphicsImageDrawingActions,
224 ) -> Retained<UIImage>;
225
226 #[cfg(feature = "block2")]
227 #[unsafe(method(PNGDataWithActions:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn PNGDataWithActions(
230 &self,
231 actions: UIGraphicsImageDrawingActions,
232 ) -> Retained<NSData>;
233
234 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
235 #[unsafe(method(JPEGDataWithCompressionQuality:actions:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn JPEGDataWithCompressionQuality_actions(
238 &self,
239 compression_quality: CGFloat,
240 actions: UIGraphicsImageDrawingActions,
241 ) -> Retained<NSData>;
242 );
243}
244
245#[cfg(feature = "UIGraphicsRenderer")]
247impl UIGraphicsImageRenderer {
248 extern_methods!(
249 #[cfg(feature = "objc2-core-foundation")]
250 #[unsafe(method(initWithBounds:))]
251 #[unsafe(method_family = init)]
252 pub unsafe fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
253 );
254}
255
256#[cfg(feature = "UIGraphicsRenderer")]
258impl UIGraphicsImageRenderer {
259 extern_methods!(
260 #[unsafe(method(init))]
261 #[unsafe(method_family = init)]
262 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
263
264 #[unsafe(method(new))]
265 #[unsafe(method_family = new)]
266 pub unsafe fn new() -> Retained<Self>;
267 );
268}