objc2_gl_kit/generated/
GLKTextureLoader.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-app-kit")]
9#[cfg(target_os = "macos")]
10use objc2_app_kit::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13#[cfg(feature = "objc2-core-graphics")]
14use objc2_core_graphics::*;
15use objc2_foundation::*;
16#[cfg(feature = "objc2-open-gl")]
17#[cfg(target_os = "macos")]
18use objc2_open_gl::*;
19
20use crate::*;
21
22extern "C" {
23    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloaderapplypremultiplication?language=objc)
24    pub static GLKTextureLoaderApplyPremultiplication: &'static NSString;
25}
26
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadergeneratemipmaps?language=objc)
29    pub static GLKTextureLoaderGenerateMipmaps: &'static NSString;
30}
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloaderoriginbottomleft?language=objc)
34    pub static GLKTextureLoaderOriginBottomLeft: &'static NSString;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadergrayscaleasalpha?language=objc)
39    pub static GLKTextureLoaderGrayscaleAsAlpha: &'static NSString;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadersrgb?language=objc)
44    pub static GLKTextureLoaderSRGB: &'static NSString;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadererrordomain?language=objc)
49    pub static GLKTextureLoaderErrorDomain: &'static NSString;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadererrorkey?language=objc)
54    pub static GLKTextureLoaderErrorKey: &'static NSString;
55}
56
57extern "C" {
58    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloaderglerrorkey?language=objc)
59    pub static GLKTextureLoaderGLErrorKey: &'static NSString;
60}
61
62/// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadererror?language=objc)
63// NS_ENUM
64#[cfg(feature = "objc2-open-gl")]
65#[cfg(target_os = "macos")]
66#[repr(transparent)]
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
68pub struct GLKTextureLoaderError(pub GLuint);
69#[cfg(feature = "objc2-open-gl")]
70#[cfg(target_os = "macos")]
71impl GLKTextureLoaderError {
72    #[doc(alias = "GLKTextureLoaderErrorFileOrURLNotFound")]
73    pub const FileOrURLNotFound: Self = Self(0);
74    #[doc(alias = "GLKTextureLoaderErrorInvalidNSData")]
75    pub const InvalidNSData: Self = Self(1);
76    #[doc(alias = "GLKTextureLoaderErrorInvalidCGImage")]
77    pub const InvalidCGImage: Self = Self(2);
78    #[doc(alias = "GLKTextureLoaderErrorUnknownPathType")]
79    pub const UnknownPathType: Self = Self(3);
80    #[doc(alias = "GLKTextureLoaderErrorUnknownFileType")]
81    pub const UnknownFileType: Self = Self(4);
82    #[doc(alias = "GLKTextureLoaderErrorPVRAtlasUnsupported")]
83    pub const PVRAtlasUnsupported: Self = Self(5);
84    #[doc(alias = "GLKTextureLoaderErrorCubeMapInvalidNumFiles")]
85    pub const CubeMapInvalidNumFiles: Self = Self(6);
86    #[doc(alias = "GLKTextureLoaderErrorCompressedTextureUpload")]
87    pub const CompressedTextureUpload: Self = Self(7);
88    #[doc(alias = "GLKTextureLoaderErrorUncompressedTextureUpload")]
89    pub const UncompressedTextureUpload: Self = Self(8);
90    #[doc(alias = "GLKTextureLoaderErrorUnsupportedCubeMapDimensions")]
91    pub const UnsupportedCubeMapDimensions: Self = Self(9);
92    #[doc(alias = "GLKTextureLoaderErrorUnsupportedBitDepth")]
93    pub const UnsupportedBitDepth: Self = Self(10);
94    #[doc(alias = "GLKTextureLoaderErrorUnsupportedPVRFormat")]
95    pub const UnsupportedPVRFormat: Self = Self(11);
96    #[doc(alias = "GLKTextureLoaderErrorDataPreprocessingFailure")]
97    pub const DataPreprocessingFailure: Self = Self(12);
98    #[doc(alias = "GLKTextureLoaderErrorMipmapUnsupported")]
99    pub const MipmapUnsupported: Self = Self(13);
100    #[doc(alias = "GLKTextureLoaderErrorUnsupportedOrientation")]
101    pub const UnsupportedOrientation: Self = Self(14);
102    #[doc(alias = "GLKTextureLoaderErrorReorientationFailure")]
103    pub const ReorientationFailure: Self = Self(15);
104    #[doc(alias = "GLKTextureLoaderErrorAlphaPremultiplicationFailure")]
105    pub const AlphaPremultiplicationFailure: Self = Self(16);
106    #[doc(alias = "GLKTextureLoaderErrorInvalidEAGLContext")]
107    pub const InvalidEAGLContext: Self = Self(17);
108    #[doc(alias = "GLKTextureLoaderErrorIncompatibleFormatSRGB")]
109    pub const IncompatibleFormatSRGB: Self = Self(18);
110    #[doc(alias = "GLKTextureLoaderErrorUnsupportedTextureTarget")]
111    pub const UnsupportedTextureTarget: Self = Self(19);
112}
113
114#[cfg(feature = "objc2-open-gl")]
115#[cfg(target_os = "macos")]
116unsafe impl Encode for GLKTextureLoaderError {
117    const ENCODING: Encoding = GLuint::ENCODING;
118}
119
120#[cfg(feature = "objc2-open-gl")]
121#[cfg(target_os = "macos")]
122unsafe impl RefEncode for GLKTextureLoaderError {
123    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
124}
125
126/// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureinfoalphastate?language=objc)
127// NS_ENUM
128#[cfg(feature = "objc2-open-gl")]
129#[cfg(target_os = "macos")]
130#[repr(transparent)]
131#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
132pub struct GLKTextureInfoAlphaState(pub GLint);
133#[cfg(feature = "objc2-open-gl")]
134#[cfg(target_os = "macos")]
135impl GLKTextureInfoAlphaState {
136    #[doc(alias = "GLKTextureInfoAlphaStateNone")]
137    pub const None: Self = Self(0);
138    #[doc(alias = "GLKTextureInfoAlphaStateNonPremultiplied")]
139    pub const NonPremultiplied: Self = Self(1);
140    #[doc(alias = "GLKTextureInfoAlphaStatePremultiplied")]
141    pub const Premultiplied: Self = Self(2);
142}
143
144#[cfg(feature = "objc2-open-gl")]
145#[cfg(target_os = "macos")]
146unsafe impl Encode for GLKTextureInfoAlphaState {
147    const ENCODING: Encoding = GLint::ENCODING;
148}
149
150#[cfg(feature = "objc2-open-gl")]
151#[cfg(target_os = "macos")]
152unsafe impl RefEncode for GLKTextureInfoAlphaState {
153    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
154}
155
156/// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureinfoorigin?language=objc)
157// NS_ENUM
158#[cfg(feature = "objc2-open-gl")]
159#[cfg(target_os = "macos")]
160#[repr(transparent)]
161#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
162pub struct GLKTextureInfoOrigin(pub GLint);
163#[cfg(feature = "objc2-open-gl")]
164#[cfg(target_os = "macos")]
165impl GLKTextureInfoOrigin {
166    #[doc(alias = "GLKTextureInfoOriginUnknown")]
167    pub const Unknown: Self = Self(0);
168    #[doc(alias = "GLKTextureInfoOriginTopLeft")]
169    pub const TopLeft: Self = Self(1);
170    #[doc(alias = "GLKTextureInfoOriginBottomLeft")]
171    pub const BottomLeft: Self = Self(2);
172}
173
174#[cfg(feature = "objc2-open-gl")]
175#[cfg(target_os = "macos")]
176unsafe impl Encode for GLKTextureInfoOrigin {
177    const ENCODING: Encoding = GLint::ENCODING;
178}
179
180#[cfg(feature = "objc2-open-gl")]
181#[cfg(target_os = "macos")]
182unsafe impl RefEncode for GLKTextureInfoOrigin {
183    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
184}
185
186extern_class!(
187    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureinfo?language=objc)
188    #[unsafe(super(NSObject))]
189    #[derive(Debug, PartialEq, Eq, Hash)]
190    pub struct GLKTextureInfo;
191);
192
193extern_conformance!(
194    unsafe impl NSCopying for GLKTextureInfo {}
195);
196
197unsafe impl CopyingHelper for GLKTextureInfo {
198    type Result = Self;
199}
200
201extern_conformance!(
202    unsafe impl NSObjectProtocol for GLKTextureInfo {}
203);
204
205impl GLKTextureInfo {
206    extern_methods!(
207        #[cfg(feature = "objc2-open-gl")]
208        #[cfg(target_os = "macos")]
209        #[unsafe(method(name))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn name(&self) -> GLuint;
212
213        #[cfg(feature = "objc2-open-gl")]
214        #[cfg(target_os = "macos")]
215        #[unsafe(method(target))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn target(&self) -> GLenum;
218
219        #[cfg(feature = "objc2-open-gl")]
220        #[cfg(target_os = "macos")]
221        #[unsafe(method(width))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn width(&self) -> GLuint;
224
225        #[cfg(feature = "objc2-open-gl")]
226        #[cfg(target_os = "macos")]
227        #[unsafe(method(height))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn height(&self) -> GLuint;
230
231        #[cfg(feature = "objc2-open-gl")]
232        #[cfg(target_os = "macos")]
233        #[unsafe(method(depth))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn depth(&self) -> GLuint;
236
237        #[cfg(feature = "objc2-open-gl")]
238        #[cfg(target_os = "macos")]
239        #[unsafe(method(alphaState))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn alphaState(&self) -> GLKTextureInfoAlphaState;
242
243        #[cfg(feature = "objc2-open-gl")]
244        #[cfg(target_os = "macos")]
245        #[unsafe(method(textureOrigin))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn textureOrigin(&self) -> GLKTextureInfoOrigin;
248
249        #[unsafe(method(containsMipmaps))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn containsMipmaps(&self) -> bool;
252
253        #[cfg(feature = "objc2-open-gl")]
254        #[cfg(target_os = "macos")]
255        #[unsafe(method(mimapLevelCount))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn mimapLevelCount(&self) -> GLuint;
258
259        #[cfg(feature = "objc2-open-gl")]
260        #[cfg(target_os = "macos")]
261        #[unsafe(method(arrayLength))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn arrayLength(&self) -> GLuint;
264    );
265}
266
267/// Methods declared on superclass `NSObject`.
268impl GLKTextureInfo {
269    extern_methods!(
270        #[unsafe(method(init))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
273
274        #[unsafe(method(new))]
275        #[unsafe(method_family = new)]
276        pub unsafe fn new() -> Retained<Self>;
277    );
278}
279
280/// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloadercallback?language=objc)
281#[cfg(feature = "block2")]
282pub type GLKTextureLoaderCallback =
283    *mut block2::DynBlock<dyn Fn(*mut GLKTextureInfo, *mut NSError)>;
284
285extern_class!(
286    /// [Apple's documentation](https://developer.apple.com/documentation/glkit/glktextureloader?language=objc)
287    #[unsafe(super(NSObject))]
288    #[derive(Debug, PartialEq, Eq, Hash)]
289    pub struct GLKTextureLoader;
290);
291
292extern_conformance!(
293    unsafe impl NSObjectProtocol for GLKTextureLoader {}
294);
295
296impl GLKTextureLoader {
297    extern_methods!(
298        #[unsafe(method(textureWithContentsOfFile:options:error:_))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn textureWithContentsOfFile_options_error(
301            path: &NSString,
302            options: Option<&NSDictionary<NSString, NSNumber>>,
303        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
304
305        #[unsafe(method(textureWithContentsOfURL:options:error:_))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn textureWithContentsOfURL_options_error(
308            url: &NSURL,
309            options: Option<&NSDictionary<NSString, NSNumber>>,
310        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
311
312        #[cfg(feature = "objc2-core-foundation")]
313        #[unsafe(method(textureWithName:scaleFactor:bundle:options:error:_))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn textureWithName_scaleFactor_bundle_options_error(
316            name: &NSString,
317            scale_factor: CGFloat,
318            bundle: Option<&NSBundle>,
319            options: Option<&NSDictionary<NSString, NSNumber>>,
320        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
321
322        #[unsafe(method(textureWithContentsOfData:options:error:_))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn textureWithContentsOfData_options_error(
325            data: &NSData,
326            options: Option<&NSDictionary<NSString, NSNumber>>,
327        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
328
329        #[cfg(feature = "objc2-core-graphics")]
330        #[unsafe(method(textureWithCGImage:options:error:_))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn textureWithCGImage_options_error(
333            cg_image: &CGImage,
334            options: Option<&NSDictionary<NSString, NSNumber>>,
335        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
336
337        /// # Safety
338        ///
339        /// `paths` generic should be of the correct type.
340        #[unsafe(method(cubeMapWithContentsOfFiles:options:error:_))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn cubeMapWithContentsOfFiles_options_error(
343            paths: &NSArray<AnyObject>,
344            options: Option<&NSDictionary<NSString, NSNumber>>,
345        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
346
347        #[unsafe(method(cubeMapWithContentsOfFile:options:error:_))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn cubeMapWithContentsOfFile_options_error(
350            path: &NSString,
351            options: Option<&NSDictionary<NSString, NSNumber>>,
352        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
353
354        #[unsafe(method(cubeMapWithContentsOfURL:options:error:_))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn cubeMapWithContentsOfURL_options_error(
357            url: &NSURL,
358            options: Option<&NSDictionary<NSString, NSNumber>>,
359        ) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
360
361        #[cfg(feature = "objc2-app-kit")]
362        #[cfg(target_os = "macos")]
363        #[unsafe(method(initWithShareContext:))]
364        #[unsafe(method_family = init)]
365        pub unsafe fn initWithShareContext(
366            this: Allocated<Self>,
367            context: &NSOpenGLContext,
368        ) -> Retained<Self>;
369
370        #[cfg(all(feature = "block2", feature = "dispatch2"))]
371        /// # Safety
372        ///
373        /// - `queue` possibly has additional threading requirements.
374        /// - `block` must be a valid pointer.
375        #[unsafe(method(textureWithContentsOfFile:options:queue:completionHandler:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn textureWithContentsOfFile_options_queue_completionHandler(
378            &self,
379            path: &NSString,
380            options: Option<&NSDictionary<NSString, NSNumber>>,
381            queue: Option<&DispatchQueue>,
382            block: GLKTextureLoaderCallback,
383        );
384
385        #[cfg(all(feature = "block2", feature = "dispatch2"))]
386        /// # Safety
387        ///
388        /// - `queue` possibly has additional threading requirements.
389        /// - `block` must be a valid pointer.
390        #[unsafe(method(textureWithContentsOfURL:options:queue:completionHandler:))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn textureWithContentsOfURL_options_queue_completionHandler(
393            &self,
394            url: &NSURL,
395            options: Option<&NSDictionary<NSString, NSNumber>>,
396            queue: Option<&DispatchQueue>,
397            block: GLKTextureLoaderCallback,
398        );
399
400        #[cfg(all(
401            feature = "block2",
402            feature = "dispatch2",
403            feature = "objc2-core-foundation"
404        ))]
405        /// # Safety
406        ///
407        /// - `queue` possibly has additional threading requirements.
408        /// - `block` must be a valid pointer.
409        #[unsafe(method(textureWithName:scaleFactor:bundle:options:queue:completionHandler:))]
410        #[unsafe(method_family = none)]
411        pub unsafe fn textureWithName_scaleFactor_bundle_options_queue_completionHandler(
412            &self,
413            name: &NSString,
414            scale_factor: CGFloat,
415            bundle: Option<&NSBundle>,
416            options: Option<&NSDictionary<NSString, NSNumber>>,
417            queue: Option<&DispatchQueue>,
418            block: GLKTextureLoaderCallback,
419        );
420
421        #[cfg(all(feature = "block2", feature = "dispatch2"))]
422        /// # Safety
423        ///
424        /// - `queue` possibly has additional threading requirements.
425        /// - `block` must be a valid pointer.
426        #[unsafe(method(textureWithContentsOfData:options:queue:completionHandler:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn textureWithContentsOfData_options_queue_completionHandler(
429            &self,
430            data: &NSData,
431            options: Option<&NSDictionary<NSString, NSNumber>>,
432            queue: Option<&DispatchQueue>,
433            block: GLKTextureLoaderCallback,
434        );
435
436        #[cfg(all(
437            feature = "block2",
438            feature = "dispatch2",
439            feature = "objc2-core-graphics"
440        ))]
441        /// # Safety
442        ///
443        /// - `queue` possibly has additional threading requirements.
444        /// - `block` must be a valid pointer.
445        #[unsafe(method(textureWithCGImage:options:queue:completionHandler:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn textureWithCGImage_options_queue_completionHandler(
448            &self,
449            cg_image: &CGImage,
450            options: Option<&NSDictionary<NSString, NSNumber>>,
451            queue: Option<&DispatchQueue>,
452            block: GLKTextureLoaderCallback,
453        );
454
455        #[cfg(all(feature = "block2", feature = "dispatch2"))]
456        /// # Safety
457        ///
458        /// - `paths` generic should be of the correct type.
459        /// - `queue` possibly has additional threading requirements.
460        /// - `block` must be a valid pointer.
461        #[unsafe(method(cubeMapWithContentsOfFiles:options:queue:completionHandler:))]
462        #[unsafe(method_family = none)]
463        pub unsafe fn cubeMapWithContentsOfFiles_options_queue_completionHandler(
464            &self,
465            paths: &NSArray<AnyObject>,
466            options: Option<&NSDictionary<NSString, NSNumber>>,
467            queue: Option<&DispatchQueue>,
468            block: GLKTextureLoaderCallback,
469        );
470
471        #[cfg(all(feature = "block2", feature = "dispatch2"))]
472        /// # Safety
473        ///
474        /// - `queue` possibly has additional threading requirements.
475        /// - `block` must be a valid pointer.
476        #[unsafe(method(cubeMapWithContentsOfFile:options:queue:completionHandler:))]
477        #[unsafe(method_family = none)]
478        pub unsafe fn cubeMapWithContentsOfFile_options_queue_completionHandler(
479            &self,
480            path: &NSString,
481            options: Option<&NSDictionary<NSString, NSNumber>>,
482            queue: Option<&DispatchQueue>,
483            block: GLKTextureLoaderCallback,
484        );
485
486        #[cfg(all(feature = "block2", feature = "dispatch2"))]
487        /// # Safety
488        ///
489        /// - `queue` possibly has additional threading requirements.
490        /// - `block` must be a valid pointer.
491        #[unsafe(method(cubeMapWithContentsOfURL:options:queue:completionHandler:))]
492        #[unsafe(method_family = none)]
493        pub unsafe fn cubeMapWithContentsOfURL_options_queue_completionHandler(
494            &self,
495            url: &NSURL,
496            options: Option<&NSDictionary<NSString, NSNumber>>,
497            queue: Option<&DispatchQueue>,
498            block: GLKTextureLoaderCallback,
499        );
500    );
501}
502
503/// Methods declared on superclass `NSObject`.
504impl GLKTextureLoader {
505    extern_methods!(
506        #[unsafe(method(init))]
507        #[unsafe(method_family = init)]
508        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
509
510        #[unsafe(method(new))]
511        #[unsafe(method_family = new)]
512        pub unsafe fn new() -> Retained<Self>;
513    );
514}