use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
use objc2_open_gl::*;
use crate::*;
extern "C" {
pub static GLKTextureLoaderApplyPremultiplication: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderGenerateMipmaps: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderOriginBottomLeft: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderGrayscaleAsAlpha: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderSRGB: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderErrorDomain: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderErrorKey: &'static NSString;
}
extern "C" {
pub static GLKTextureLoaderGLErrorKey: &'static NSString;
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GLKTextureLoaderError(pub GLuint);
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
impl GLKTextureLoaderError {
#[doc(alias = "GLKTextureLoaderErrorFileOrURLNotFound")]
pub const FileOrURLNotFound: Self = Self(0);
#[doc(alias = "GLKTextureLoaderErrorInvalidNSData")]
pub const InvalidNSData: Self = Self(1);
#[doc(alias = "GLKTextureLoaderErrorInvalidCGImage")]
pub const InvalidCGImage: Self = Self(2);
#[doc(alias = "GLKTextureLoaderErrorUnknownPathType")]
pub const UnknownPathType: Self = Self(3);
#[doc(alias = "GLKTextureLoaderErrorUnknownFileType")]
pub const UnknownFileType: Self = Self(4);
#[doc(alias = "GLKTextureLoaderErrorPVRAtlasUnsupported")]
pub const PVRAtlasUnsupported: Self = Self(5);
#[doc(alias = "GLKTextureLoaderErrorCubeMapInvalidNumFiles")]
pub const CubeMapInvalidNumFiles: Self = Self(6);
#[doc(alias = "GLKTextureLoaderErrorCompressedTextureUpload")]
pub const CompressedTextureUpload: Self = Self(7);
#[doc(alias = "GLKTextureLoaderErrorUncompressedTextureUpload")]
pub const UncompressedTextureUpload: Self = Self(8);
#[doc(alias = "GLKTextureLoaderErrorUnsupportedCubeMapDimensions")]
pub const UnsupportedCubeMapDimensions: Self = Self(9);
#[doc(alias = "GLKTextureLoaderErrorUnsupportedBitDepth")]
pub const UnsupportedBitDepth: Self = Self(10);
#[doc(alias = "GLKTextureLoaderErrorUnsupportedPVRFormat")]
pub const UnsupportedPVRFormat: Self = Self(11);
#[doc(alias = "GLKTextureLoaderErrorDataPreprocessingFailure")]
pub const DataPreprocessingFailure: Self = Self(12);
#[doc(alias = "GLKTextureLoaderErrorMipmapUnsupported")]
pub const MipmapUnsupported: Self = Self(13);
#[doc(alias = "GLKTextureLoaderErrorUnsupportedOrientation")]
pub const UnsupportedOrientation: Self = Self(14);
#[doc(alias = "GLKTextureLoaderErrorReorientationFailure")]
pub const ReorientationFailure: Self = Self(15);
#[doc(alias = "GLKTextureLoaderErrorAlphaPremultiplicationFailure")]
pub const AlphaPremultiplicationFailure: Self = Self(16);
#[doc(alias = "GLKTextureLoaderErrorInvalidEAGLContext")]
pub const InvalidEAGLContext: Self = Self(17);
#[doc(alias = "GLKTextureLoaderErrorIncompatibleFormatSRGB")]
pub const IncompatibleFormatSRGB: Self = Self(18);
#[doc(alias = "GLKTextureLoaderErrorUnsupportedTextureTarget")]
pub const UnsupportedTextureTarget: Self = Self(19);
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl Encode for GLKTextureLoaderError {
const ENCODING: Encoding = GLuint::ENCODING;
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl RefEncode for GLKTextureLoaderError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GLKTextureInfoAlphaState(pub GLint);
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
impl GLKTextureInfoAlphaState {
#[doc(alias = "GLKTextureInfoAlphaStateNone")]
pub const None: Self = Self(0);
#[doc(alias = "GLKTextureInfoAlphaStateNonPremultiplied")]
pub const NonPremultiplied: Self = Self(1);
#[doc(alias = "GLKTextureInfoAlphaStatePremultiplied")]
pub const Premultiplied: Self = Self(2);
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl Encode for GLKTextureInfoAlphaState {
const ENCODING: Encoding = GLint::ENCODING;
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl RefEncode for GLKTextureInfoAlphaState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GLKTextureInfoOrigin(pub GLint);
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
impl GLKTextureInfoOrigin {
#[doc(alias = "GLKTextureInfoOriginUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "GLKTextureInfoOriginTopLeft")]
pub const TopLeft: Self = Self(1);
#[doc(alias = "GLKTextureInfoOriginBottomLeft")]
pub const BottomLeft: Self = Self(2);
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl Encode for GLKTextureInfoOrigin {
const ENCODING: Encoding = GLint::ENCODING;
}
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
unsafe impl RefEncode for GLKTextureInfoOrigin {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GLKTextureInfo;
);
extern_conformance!(
unsafe impl NSCopying for GLKTextureInfo {}
);
unsafe impl CopyingHelper for GLKTextureInfo {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for GLKTextureInfo {}
);
impl GLKTextureInfo {
extern_methods!(
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> GLuint;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(target))]
#[unsafe(method_family = none)]
pub unsafe fn target(&self) -> GLenum;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(width))]
#[unsafe(method_family = none)]
pub unsafe fn width(&self) -> GLuint;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(height))]
#[unsafe(method_family = none)]
pub unsafe fn height(&self) -> GLuint;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(depth))]
#[unsafe(method_family = none)]
pub unsafe fn depth(&self) -> GLuint;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(alphaState))]
#[unsafe(method_family = none)]
pub unsafe fn alphaState(&self) -> GLKTextureInfoAlphaState;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(textureOrigin))]
#[unsafe(method_family = none)]
pub unsafe fn textureOrigin(&self) -> GLKTextureInfoOrigin;
#[unsafe(method(containsMipmaps))]
#[unsafe(method_family = none)]
pub unsafe fn containsMipmaps(&self) -> bool;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(mimapLevelCount))]
#[unsafe(method_family = none)]
pub unsafe fn mimapLevelCount(&self) -> GLuint;
#[cfg(feature = "objc2-open-gl")]
#[cfg(target_os = "macos")]
#[unsafe(method(arrayLength))]
#[unsafe(method_family = none)]
pub unsafe fn arrayLength(&self) -> GLuint;
);
}
impl GLKTextureInfo {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
#[cfg(feature = "block2")]
pub type GLKTextureLoaderCallback =
*mut block2::DynBlock<dyn Fn(*mut GLKTextureInfo, *mut NSError)>;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GLKTextureLoader;
);
extern_conformance!(
unsafe impl NSObjectProtocol for GLKTextureLoader {}
);
impl GLKTextureLoader {
extern_methods!(
#[unsafe(method(textureWithContentsOfFile:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfFile_options_error(
path: &NSString,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[unsafe(method(textureWithContentsOfURL:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfURL_options_error(
url: &NSURL,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(textureWithName:scaleFactor:bundle:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithName_scaleFactor_bundle_options_error(
name: &NSString,
scale_factor: CGFloat,
bundle: Option<&NSBundle>,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[unsafe(method(textureWithContentsOfData:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfData_options_error(
data: &NSData,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(textureWithCGImage:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithCGImage_options_error(
cg_image: &CGImage,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[unsafe(method(cubeMapWithContentsOfFiles:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfFiles_options_error(
paths: &NSArray<AnyObject>,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[unsafe(method(cubeMapWithContentsOfFile:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfFile_options_error(
path: &NSString,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[unsafe(method(cubeMapWithContentsOfURL:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfURL_options_error(
url: &NSURL,
options: Option<&NSDictionary<NSString, NSNumber>>,
) -> Result<Retained<GLKTextureInfo>, Retained<NSError>>;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(initWithShareContext:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithShareContext(
this: Allocated<Self>,
context: &NSOpenGLContext,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(textureWithContentsOfFile:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfFile_options_queue_completionHandler(
&self,
path: &NSString,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(textureWithContentsOfURL:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfURL_options_queue_completionHandler(
&self,
url: &NSURL,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(
feature = "block2",
feature = "dispatch2",
feature = "objc2-core-foundation"
))]
#[unsafe(method(textureWithName:scaleFactor:bundle:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithName_scaleFactor_bundle_options_queue_completionHandler(
&self,
name: &NSString,
scale_factor: CGFloat,
bundle: Option<&NSBundle>,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(textureWithContentsOfData:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithContentsOfData_options_queue_completionHandler(
&self,
data: &NSData,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(
feature = "block2",
feature = "dispatch2",
feature = "objc2-core-graphics"
))]
#[unsafe(method(textureWithCGImage:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn textureWithCGImage_options_queue_completionHandler(
&self,
cg_image: &CGImage,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(cubeMapWithContentsOfFiles:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfFiles_options_queue_completionHandler(
&self,
paths: &NSArray<AnyObject>,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(cubeMapWithContentsOfFile:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfFile_options_queue_completionHandler(
&self,
path: &NSString,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
#[cfg(all(feature = "block2", feature = "dispatch2"))]
#[unsafe(method(cubeMapWithContentsOfURL:options:queue:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn cubeMapWithContentsOfURL_options_queue_completionHandler(
&self,
url: &NSURL,
options: Option<&NSDictionary<NSString, NSNumber>>,
queue: Option<&DispatchQueue>,
block: GLKTextureLoaderCallback,
);
);
}
impl GLKTextureLoader {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}