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
19unsafe impl NSCopying for UIImageReaderConfiguration {}
20
21unsafe impl CopyingHelper for UIImageReaderConfiguration {
22    type Result = Self;
23}
24
25unsafe impl NSObjectProtocol for UIImageReaderConfiguration {}
26
27impl UIImageReaderConfiguration {
28    extern_methods!(
29        /// 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.
30        #[unsafe(method(prefersHighDynamicRange))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn prefersHighDynamicRange(&self) -> bool;
33
34        /// Setter for [`prefersHighDynamicRange`][Self::prefersHighDynamicRange].
35        #[unsafe(method(setPrefersHighDynamicRange:))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn setPrefersHighDynamicRange(&self, prefers_high_dynamic_range: bool);
38
39        /// If set, images vended by the loader are automatically prepared for display. Default is NO.
40        #[unsafe(method(preparesImagesForDisplay))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn preparesImagesForDisplay(&self) -> bool;
43
44        /// Setter for [`preparesImagesForDisplay`][Self::preparesImagesForDisplay].
45        #[unsafe(method(setPreparesImagesForDisplay:))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn setPreparesImagesForDisplay(&self, prepares_images_for_display: bool);
48
49        #[cfg(feature = "objc2-core-foundation")]
50        /// 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.
51        #[unsafe(method(preferredThumbnailSize))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn preferredThumbnailSize(&self) -> CGSize;
54
55        #[cfg(feature = "objc2-core-foundation")]
56        /// Setter for [`preferredThumbnailSize`][Self::preferredThumbnailSize].
57        #[unsafe(method(setPreferredThumbnailSize:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setPreferredThumbnailSize(&self, preferred_thumbnail_size: CGSize);
60
61        #[cfg(feature = "objc2-core-foundation")]
62        /// 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.
63        #[unsafe(method(pixelsPerInch))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn pixelsPerInch(&self) -> CGFloat;
66
67        #[cfg(feature = "objc2-core-foundation")]
68        /// Setter for [`pixelsPerInch`][Self::pixelsPerInch].
69        #[unsafe(method(setPixelsPerInch:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setPixelsPerInch(&self, pixels_per_inch: CGFloat);
72    );
73}
74
75/// Methods declared on superclass `NSObject`.
76impl UIImageReaderConfiguration {
77    extern_methods!(
78        #[unsafe(method(init))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
81
82        #[unsafe(method(new))]
83        #[unsafe(method_family = new)]
84        pub unsafe fn new() -> Retained<Self>;
85    );
86}
87
88extern_class!(
89    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimagereader?language=objc)
90    #[unsafe(super(NSObject))]
91    #[derive(Debug, PartialEq, Eq, Hash)]
92    pub struct UIImageReader;
93);
94
95unsafe impl NSObjectProtocol for UIImageReader {}
96
97impl UIImageReader {
98    extern_methods!(
99        /// Returns a reader that uses the default configuration options. This method is thread safe.
100        #[unsafe(method(defaultReader))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn defaultReader() -> Retained<UIImageReader>;
103
104        /// Returns a loader of the given configuration. Loaders are thread safe and sharable.
105        #[unsafe(method(readerWithConfiguration:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn readerWithConfiguration(
108            configuration: &UIImageReaderConfiguration,
109        ) -> Retained<Self>;
110
111        #[unsafe(method(configuration))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn configuration(&self) -> Retained<UIImageReaderConfiguration>;
114
115        #[cfg(feature = "UIImage")]
116        /// Synchronously generate an image from the given file URL. If an image could not be generated, returns nil.
117        #[unsafe(method(imageWithContentsOfFileURL:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn imageWithContentsOfFileURL(&self, url: &NSURL) -> Retained<UIImage>;
120
121        #[cfg(feature = "UIImage")]
122        /// Synchronously generate an image from the given data. If an image could not be generated, returns nil.
123        #[unsafe(method(imageWithData:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn imageWithData(&self, data: &NSData) -> Retained<UIImage>;
126
127        #[cfg(all(feature = "UIImage", feature = "block2"))]
128        /// Asynchronously generate an image from the given file URL. If an image could not be generated, the completion will be called with nil.
129        #[unsafe(method(imageWithContentsOfFileURL:completion:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn imageWithContentsOfFileURL_completion(
132            &self,
133            url: &NSURL,
134            completion: &block2::Block<dyn Fn(*mut UIImage)>,
135        );
136
137        #[cfg(all(feature = "UIImage", feature = "block2"))]
138        /// Asynchronously generate an image from the given data. If an image could not be generated, the completion will be called with nil.
139        #[unsafe(method(imageWithData:completion:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn imageWithData_completion(
142            &self,
143            data: &NSData,
144            completion: &block2::Block<dyn Fn(*mut UIImage)>,
145        );
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150impl UIImageReader {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}