objc2_ui_kit/generated/
UIImageReader.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimagereaderconfiguration?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIImageReaderConfiguration;
17);
18
19extern_conformance!(
20    unsafe impl NSCopying for UIImageReaderConfiguration {}
21);
22
23unsafe impl CopyingHelper for UIImageReaderConfiguration {
24    type Result = Self;
25}
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for UIImageReaderConfiguration {}
29);
30
31impl UIImageReaderConfiguration {
32    extern_methods!(
33        /// For image types that may decode as either SDR or HDR, prefer the HDR variant. Images that may only decode as either SDR or HDR are unaffected. Default depends on system capabilities.
34        #[unsafe(method(prefersHighDynamicRange))]
35        #[unsafe(method_family = none)]
36        pub fn prefersHighDynamicRange(&self) -> bool;
37
38        /// Setter for [`prefersHighDynamicRange`][Self::prefersHighDynamicRange].
39        #[unsafe(method(setPrefersHighDynamicRange:))]
40        #[unsafe(method_family = none)]
41        pub fn setPrefersHighDynamicRange(&self, prefers_high_dynamic_range: bool);
42
43        /// If set, images vended by the loader are automatically prepared for display. Default is NO.
44        #[unsafe(method(preparesImagesForDisplay))]
45        #[unsafe(method_family = none)]
46        pub fn preparesImagesForDisplay(&self) -> bool;
47
48        /// Setter for [`preparesImagesForDisplay`][Self::preparesImagesForDisplay].
49        #[unsafe(method(setPreparesImagesForDisplay:))]
50        #[unsafe(method_family = none)]
51        pub fn setPreparesImagesForDisplay(&self, prepares_images_for_display: bool);
52
53        #[cfg(feature = "objc2-core-foundation")]
54        /// If set, images loaded will be thumbnails of approximately the given size. Default value is CGSizeZero, indicating that thumb-nailing is disabled. This size is always in pixels.
55        #[unsafe(method(preferredThumbnailSize))]
56        #[unsafe(method_family = none)]
57        pub fn preferredThumbnailSize(&self) -> CGSize;
58
59        #[cfg(feature = "objc2-core-foundation")]
60        /// Setter for [`preferredThumbnailSize`][Self::preferredThumbnailSize].
61        #[unsafe(method(setPreferredThumbnailSize:))]
62        #[unsafe(method_family = none)]
63        pub fn setPreferredThumbnailSize(&self, preferred_thumbnail_size: CGSize);
64
65        #[cfg(feature = "objc2-core-foundation")]
66        /// If non-zero when generating images, image metadata information (if present) will be used to determine the scale to assign to the image. If zero all images will be assigned a scale of 1.0. Always assigns integral scales. Defaults to 0.
67        #[unsafe(method(pixelsPerInch))]
68        #[unsafe(method_family = none)]
69        pub fn pixelsPerInch(&self) -> CGFloat;
70
71        #[cfg(feature = "objc2-core-foundation")]
72        /// Setter for [`pixelsPerInch`][Self::pixelsPerInch].
73        #[unsafe(method(setPixelsPerInch:))]
74        #[unsafe(method_family = none)]
75        pub fn setPixelsPerInch(&self, pixels_per_inch: CGFloat);
76    );
77}
78
79/// Methods declared on superclass `NSObject`.
80impl UIImageReaderConfiguration {
81    extern_methods!(
82        #[unsafe(method(init))]
83        #[unsafe(method_family = init)]
84        pub fn init(this: Allocated<Self>) -> Retained<Self>;
85
86        #[unsafe(method(new))]
87        #[unsafe(method_family = new)]
88        pub fn new() -> Retained<Self>;
89    );
90}
91
92impl DefaultRetained for UIImageReaderConfiguration {
93    #[inline]
94    fn default_retained() -> Retained<Self> {
95        Self::new()
96    }
97}
98
99extern_class!(
100    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimagereader?language=objc)
101    #[unsafe(super(NSObject))]
102    #[derive(Debug, PartialEq, Eq, Hash)]
103    pub struct UIImageReader;
104);
105
106extern_conformance!(
107    unsafe impl NSObjectProtocol for UIImageReader {}
108);
109
110impl UIImageReader {
111    extern_methods!(
112        /// Returns a reader that uses the default configuration options. This method is thread safe.
113        #[unsafe(method(defaultReader))]
114        #[unsafe(method_family = none)]
115        pub fn defaultReader() -> Retained<UIImageReader>;
116
117        /// Returns a loader of the given configuration. Loaders are thread safe and sharable.
118        #[unsafe(method(readerWithConfiguration:))]
119        #[unsafe(method_family = none)]
120        pub fn readerWithConfiguration(
121            configuration: &UIImageReaderConfiguration,
122        ) -> Retained<Self>;
123
124        #[unsafe(method(configuration))]
125        #[unsafe(method_family = none)]
126        pub fn configuration(&self) -> Retained<UIImageReaderConfiguration>;
127
128        #[cfg(feature = "UIImage")]
129        /// Synchronously generate an image from the given file URL. If an image could not be generated, returns nil.
130        #[unsafe(method(imageWithContentsOfFileURL:))]
131        #[unsafe(method_family = none)]
132        pub fn imageWithContentsOfFileURL(&self, url: &NSURL) -> Retained<UIImage>;
133
134        #[cfg(feature = "UIImage")]
135        /// Synchronously generate an image from the given data. If an image could not be generated, returns nil.
136        #[unsafe(method(imageWithData:))]
137        #[unsafe(method_family = none)]
138        pub fn imageWithData(&self, data: &NSData) -> Retained<UIImage>;
139
140        #[cfg(all(feature = "UIImage", feature = "block2"))]
141        /// Asynchronously generate an image from the given file URL. If an image could not be generated, the completion will be called with nil.
142        #[unsafe(method(imageWithContentsOfFileURL:completion:))]
143        #[unsafe(method_family = none)]
144        pub fn imageWithContentsOfFileURL_completion(
145            &self,
146            url: &NSURL,
147            completion: &block2::DynBlock<dyn Fn(*mut UIImage)>,
148        );
149
150        #[cfg(all(feature = "UIImage", feature = "block2"))]
151        /// Asynchronously generate an image from the given data. If an image could not be generated, the completion will be called with nil.
152        #[unsafe(method(imageWithData:completion:))]
153        #[unsafe(method_family = none)]
154        pub fn imageWithData_completion(
155            &self,
156            data: &NSData,
157            completion: &block2::DynBlock<dyn Fn(*mut UIImage)>,
158        );
159    );
160}
161
162/// Methods declared on superclass `NSObject`.
163impl UIImageReader {
164    extern_methods!(
165        #[unsafe(method(init))]
166        #[unsafe(method_family = init)]
167        pub fn init(this: Allocated<Self>) -> Retained<Self>;
168
169        #[unsafe(method(new))]
170        #[unsafe(method_family = new)]
171        pub fn new() -> Retained<Self>;
172    );
173}
174
175impl DefaultRetained for UIImageReader {
176    #[inline]
177    fn default_retained() -> Retained<Self> {
178        Self::new()
179    }
180}