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 unsafe fn prefersHighDynamicRange(&self) -> bool;
37
38        /// Setter for [`prefersHighDynamicRange`][Self::prefersHighDynamicRange].
39        #[unsafe(method(setPrefersHighDynamicRange:))]
40        #[unsafe(method_family = none)]
41        pub unsafe 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 unsafe fn preparesImagesForDisplay(&self) -> bool;
47
48        /// Setter for [`preparesImagesForDisplay`][Self::preparesImagesForDisplay].
49        #[unsafe(method(setPreparesImagesForDisplay:))]
50        #[unsafe(method_family = none)]
51        pub unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
85
86        #[unsafe(method(new))]
87        #[unsafe(method_family = new)]
88        pub unsafe fn new() -> Retained<Self>;
89    );
90}
91
92extern_class!(
93    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimagereader?language=objc)
94    #[unsafe(super(NSObject))]
95    #[derive(Debug, PartialEq, Eq, Hash)]
96    pub struct UIImageReader;
97);
98
99extern_conformance!(
100    unsafe impl NSObjectProtocol for UIImageReader {}
101);
102
103impl UIImageReader {
104    extern_methods!(
105        /// Returns a reader that uses the default configuration options. This method is thread safe.
106        #[unsafe(method(defaultReader))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn defaultReader() -> Retained<UIImageReader>;
109
110        /// Returns a loader of the given configuration. Loaders are thread safe and sharable.
111        #[unsafe(method(readerWithConfiguration:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn readerWithConfiguration(
114            configuration: &UIImageReaderConfiguration,
115        ) -> Retained<Self>;
116
117        #[unsafe(method(configuration))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn configuration(&self) -> Retained<UIImageReaderConfiguration>;
120
121        #[cfg(feature = "UIImage")]
122        /// Synchronously generate an image from the given file URL. If an image could not be generated, returns nil.
123        #[unsafe(method(imageWithContentsOfFileURL:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn imageWithContentsOfFileURL(&self, url: &NSURL) -> Retained<UIImage>;
126
127        #[cfg(feature = "UIImage")]
128        /// Synchronously generate an image from the given data. If an image could not be generated, returns nil.
129        #[unsafe(method(imageWithData:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn imageWithData(&self, data: &NSData) -> Retained<UIImage>;
132
133        #[cfg(all(feature = "UIImage", feature = "block2"))]
134        /// Asynchronously generate an image from the given file URL. If an image could not be generated, the completion will be called with nil.
135        #[unsafe(method(imageWithContentsOfFileURL:completion:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn imageWithContentsOfFileURL_completion(
138            &self,
139            url: &NSURL,
140            completion: &block2::DynBlock<dyn Fn(*mut UIImage)>,
141        );
142
143        #[cfg(all(feature = "UIImage", feature = "block2"))]
144        /// Asynchronously generate an image from the given data. If an image could not be generated, the completion will be called with nil.
145        #[unsafe(method(imageWithData:completion:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn imageWithData_completion(
148            &self,
149            data: &NSData,
150            completion: &block2::DynBlock<dyn Fn(*mut UIImage)>,
151        );
152    );
153}
154
155/// Methods declared on superclass `NSObject`.
156impl UIImageReader {
157    extern_methods!(
158        #[unsafe(method(init))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
161
162        #[unsafe(method(new))]
163        #[unsafe(method_family = new)]
164        pub unsafe fn new() -> Retained<Self>;
165    );
166}