objc2_ui_kit/generated/
UIGraphicsImageRenderer.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::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicsimagedrawingactions?language=objc)
13#[cfg(all(feature = "UIGraphicsRenderer", feature = "block2"))]
14pub type UIGraphicsImageDrawingActions =
15    *mut block2::DynBlock<dyn Fn(NonNull<UIGraphicsImageRendererContext>)>;
16
17/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicsimagerendererformatrange?language=objc)
18// NS_ENUM
19#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicsimagerendererformat?language=objc)
43    #[unsafe(super(UIGraphicsRendererFormat, NSObject))]
44    #[derive(Debug, PartialEq, Eq, Hash)]
45    #[cfg(feature = "UIGraphicsRenderer")]
46    pub struct UIGraphicsImageRendererFormat;
47);
48
49#[cfg(feature = "UIGraphicsRenderer")]
50extern_conformance!(
51    unsafe impl NSCopying for UIGraphicsImageRendererFormat {}
52);
53
54#[cfg(feature = "UIGraphicsRenderer")]
55unsafe impl CopyingHelper for UIGraphicsImageRendererFormat {
56    type Result = Self;
57}
58
59#[cfg(feature = "UIGraphicsRenderer")]
60extern_conformance!(
61    unsafe impl NSObjectProtocol for UIGraphicsImageRendererFormat {}
62);
63
64#[cfg(feature = "UIGraphicsRenderer")]
65impl UIGraphicsImageRendererFormat {
66    extern_methods!(
67        #[cfg(feature = "objc2-core-foundation")]
68        #[unsafe(method(scale))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn scale(&self) -> CGFloat;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        /// Setter for [`scale`][Self::scale].
74        #[unsafe(method(setScale:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setScale(&self, scale: CGFloat);
77
78        #[unsafe(method(opaque))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn opaque(&self) -> bool;
81
82        /// Setter for [`opaque`][Self::opaque].
83        #[unsafe(method(setOpaque:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setOpaque(&self, opaque: bool);
86
87        #[deprecated = "Use the preferredRange property instead"]
88        #[unsafe(method(prefersExtendedRange))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn prefersExtendedRange(&self) -> bool;
91
92        /// Setter for [`prefersExtendedRange`][Self::prefersExtendedRange].
93        #[deprecated = "Use the preferredRange property instead"]
94        #[unsafe(method(setPrefersExtendedRange:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setPrefersExtendedRange(&self, prefers_extended_range: bool);
97
98        #[unsafe(method(supportsHighDynamicRange))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn supportsHighDynamicRange(&self) -> bool;
101
102        /// indicates if the format supports high dynamic range rendering.
103        #[unsafe(method(preferredRange))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn preferredRange(&self) -> UIGraphicsImageRendererFormatRange;
106
107        /// Setter for [`preferredRange`][Self::preferredRange].
108        #[unsafe(method(setPreferredRange:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setPreferredRange(&self, preferred_range: UIGraphicsImageRendererFormatRange);
111
112        #[cfg(feature = "UITraitCollection")]
113        #[unsafe(method(formatForTraitCollection:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn formatForTraitCollection(
116            trait_collection: &UITraitCollection,
117        ) -> Retained<Self>;
118    );
119}
120
121/// Methods declared on superclass `UIGraphicsRendererFormat`.
122#[cfg(feature = "UIGraphicsRenderer")]
123impl UIGraphicsImageRendererFormat {
124    extern_methods!(
125        #[deprecated]
126        #[unsafe(method(defaultFormat))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn defaultFormat() -> Retained<Self>;
129
130        #[unsafe(method(preferredFormat))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn preferredFormat() -> Retained<Self>;
133    );
134}
135
136/// Methods declared on superclass `NSObject`.
137#[cfg(feature = "UIGraphicsRenderer")]
138impl UIGraphicsImageRendererFormat {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}
149
150extern_class!(
151    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicsimagerenderercontext?language=objc)
152    #[unsafe(super(UIGraphicsRendererContext, NSObject))]
153    #[derive(Debug, PartialEq, Eq, Hash)]
154    #[cfg(feature = "UIGraphicsRenderer")]
155    pub struct UIGraphicsImageRendererContext;
156);
157
158#[cfg(feature = "UIGraphicsRenderer")]
159extern_conformance!(
160    unsafe impl NSObjectProtocol for UIGraphicsImageRendererContext {}
161);
162
163#[cfg(feature = "UIGraphicsRenderer")]
164impl UIGraphicsImageRendererContext {
165    extern_methods!(
166        #[cfg(feature = "UIImage")]
167        #[unsafe(method(currentImage))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn currentImage(&self) -> Retained<UIImage>;
170    );
171}
172
173/// Methods declared on superclass `NSObject`.
174#[cfg(feature = "UIGraphicsRenderer")]
175impl UIGraphicsImageRendererContext {
176    extern_methods!(
177        #[unsafe(method(init))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub unsafe fn new() -> Retained<Self>;
184    );
185}
186
187extern_class!(
188    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer?language=objc)
189    #[unsafe(super(UIGraphicsRenderer, NSObject))]
190    #[derive(Debug, PartialEq, Eq, Hash)]
191    #[cfg(feature = "UIGraphicsRenderer")]
192    pub struct UIGraphicsImageRenderer;
193);
194
195#[cfg(feature = "UIGraphicsRenderer")]
196extern_conformance!(
197    unsafe impl NSObjectProtocol for UIGraphicsImageRenderer {}
198);
199
200#[cfg(feature = "UIGraphicsRenderer")]
201impl UIGraphicsImageRenderer {
202    extern_methods!(
203        #[cfg(feature = "objc2-core-foundation")]
204        #[unsafe(method(initWithSize:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
207
208        #[cfg(feature = "objc2-core-foundation")]
209        #[unsafe(method(initWithSize:format:))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn initWithSize_format(
212            this: Allocated<Self>,
213            size: CGSize,
214            format: &UIGraphicsImageRendererFormat,
215        ) -> Retained<Self>;
216
217        #[cfg(feature = "objc2-core-foundation")]
218        #[unsafe(method(initWithBounds:format:))]
219        #[unsafe(method_family = init)]
220        pub unsafe fn initWithBounds_format(
221            this: Allocated<Self>,
222            bounds: CGRect,
223            format: &UIGraphicsImageRendererFormat,
224        ) -> Retained<Self>;
225
226        #[cfg(all(feature = "UIImage", feature = "block2"))]
227        #[unsafe(method(imageWithActions:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn imageWithActions(
230            &self,
231            actions: UIGraphicsImageDrawingActions,
232        ) -> Retained<UIImage>;
233
234        #[cfg(feature = "block2")]
235        #[unsafe(method(PNGDataWithActions:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn PNGDataWithActions(
238            &self,
239            actions: UIGraphicsImageDrawingActions,
240        ) -> Retained<NSData>;
241
242        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
243        #[unsafe(method(JPEGDataWithCompressionQuality:actions:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn JPEGDataWithCompressionQuality_actions(
246            &self,
247            compression_quality: CGFloat,
248            actions: UIGraphicsImageDrawingActions,
249        ) -> Retained<NSData>;
250    );
251}
252
253/// Methods declared on superclass `UIGraphicsRenderer`.
254#[cfg(feature = "UIGraphicsRenderer")]
255impl UIGraphicsImageRenderer {
256    extern_methods!(
257        #[cfg(feature = "objc2-core-foundation")]
258        #[unsafe(method(initWithBounds:))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
261    );
262}
263
264/// Methods declared on superclass `NSObject`.
265#[cfg(feature = "UIGraphicsRenderer")]
266impl UIGraphicsImageRenderer {
267    extern_methods!(
268        #[unsafe(method(init))]
269        #[unsafe(method_family = init)]
270        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
271
272        #[unsafe(method(new))]
273        #[unsafe(method_family = new)]
274        pub unsafe fn new() -> Retained<Self>;
275    );
276}