use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTIFFCompression(pub NSUInteger);
impl NSTIFFCompression {
#[doc(alias = "NSTIFFCompressionNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSTIFFCompressionCCITTFAX3")]
pub const CCITTFAX3: Self = Self(3);
#[doc(alias = "NSTIFFCompressionCCITTFAX4")]
pub const CCITTFAX4: Self = Self(4);
#[doc(alias = "NSTIFFCompressionLZW")]
pub const LZW: Self = Self(5);
#[doc(alias = "NSTIFFCompressionJPEG")]
pub const JPEG: Self = Self(6);
#[doc(alias = "NSTIFFCompressionNEXT")]
pub const NEXT: Self = Self(32766);
#[doc(alias = "NSTIFFCompressionPackBits")]
pub const PackBits: Self = Self(32773);
#[doc(alias = "NSTIFFCompressionOldJPEG")]
pub const OldJPEG: Self = Self(32865);
}
unsafe impl Encode for NSTIFFCompression {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTIFFCompression {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBitmapImageFileType(pub NSUInteger);
impl NSBitmapImageFileType {
#[doc(alias = "NSBitmapImageFileTypeTIFF")]
pub const TIFF: Self = Self(0);
#[doc(alias = "NSBitmapImageFileTypeBMP")]
pub const BMP: Self = Self(1);
#[doc(alias = "NSBitmapImageFileTypeGIF")]
pub const GIF: Self = Self(2);
#[doc(alias = "NSBitmapImageFileTypeJPEG")]
pub const JPEG: Self = Self(3);
#[doc(alias = "NSBitmapImageFileTypePNG")]
pub const PNG: Self = Self(4);
#[doc(alias = "NSBitmapImageFileTypeJPEG2000")]
pub const JPEG2000: Self = Self(5);
}
unsafe impl Encode for NSBitmapImageFileType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBitmapImageFileType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageRepLoadStatus(pub NSInteger);
impl NSImageRepLoadStatus {
#[doc(alias = "NSImageRepLoadStatusUnknownType")]
pub const UnknownType: Self = Self(-1);
#[doc(alias = "NSImageRepLoadStatusReadingHeader")]
pub const ReadingHeader: Self = Self(-2);
#[doc(alias = "NSImageRepLoadStatusWillNeedAllData")]
pub const WillNeedAllData: Self = Self(-3);
#[doc(alias = "NSImageRepLoadStatusInvalidData")]
pub const InvalidData: Self = Self(-4);
#[doc(alias = "NSImageRepLoadStatusUnexpectedEOF")]
pub const UnexpectedEOF: Self = Self(-5);
#[doc(alias = "NSImageRepLoadStatusCompleted")]
pub const Completed: Self = Self(-6);
}
unsafe impl Encode for NSImageRepLoadStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSImageRepLoadStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBitmapFormat(pub NSUInteger);
impl NSBitmapFormat {
#[doc(alias = "NSBitmapFormatAlphaFirst")]
pub const AlphaFirst: Self = Self(1 << 0);
#[doc(alias = "NSBitmapFormatAlphaNonpremultiplied")]
pub const AlphaNonpremultiplied: Self = Self(1 << 1);
#[doc(alias = "NSBitmapFormatFloatingPointSamples")]
pub const FloatingPointSamples: Self = Self(1 << 2);
#[doc(alias = "NSBitmapFormatSixteenBitLittleEndian")]
pub const SixteenBitLittleEndian: Self = Self(1 << 8);
#[doc(alias = "NSBitmapFormatThirtyTwoBitLittleEndian")]
pub const ThirtyTwoBitLittleEndian: Self = Self(1 << 9);
#[doc(alias = "NSBitmapFormatSixteenBitBigEndian")]
pub const SixteenBitBigEndian: Self = Self(1 << 10);
#[doc(alias = "NSBitmapFormatThirtyTwoBitBigEndian")]
pub const ThirtyTwoBitBigEndian: Self = Self(1 << 11);
}
unsafe impl Encode for NSBitmapFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBitmapFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSBitmapImageRepPropertyKey = NSString;
extern "C" {
pub static NSImageCompressionMethod: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCompressionFactor: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageDitherTransparency: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageRGBColorTable: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageInterlaced: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageColorSyncProfileData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageFrameCount: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCurrentFrame: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCurrentFrameDuration: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageLoopCount: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageGamma: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageProgressive: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageEXIFData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageIPTCData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageFallbackBackgroundColor: &'static NSBitmapImageRepPropertyKey;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
pub struct NSBitmapImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSBitmapImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSSecureCoding for NSBitmapImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[deprecated = "Use -[NSView cacheDisplayInRect:toBitmapImageRep:] to snapshot a view."]
#[method_id(@__retain_semantics Init initWithFocusedViewRect:)]
pub unsafe fn initWithFocusedViewRect(
this: Allocated<Self>,
rect: NSRect,
) -> Option<Id<Self>>;
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)]
pub unsafe fn initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel(
this: Allocated<Self>,
planes: *mut *mut c_uchar,
width: NSInteger,
height: NSInteger,
bps: NSInteger,
spp: NSInteger,
alpha: bool,
is_planar: bool,
color_space_name: &NSColorSpaceName,
r_bytes: NSInteger,
p_bits: NSInteger,
) -> Option<Id<Self>>;
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:)]
pub unsafe fn initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel(
this: Allocated<Self>,
planes: *mut *mut c_uchar,
width: NSInteger,
height: NSInteger,
bps: NSInteger,
spp: NSInteger,
alpha: bool,
is_planar: bool,
color_space_name: &NSColorSpaceName,
bitmap_format: NSBitmapFormat,
r_bytes: NSInteger,
p_bits: NSInteger,
) -> Option<Id<Self>>;
#[method_id(@__retain_semantics Other imageRepsWithData:)]
pub unsafe fn imageRepsWithData(data: &NSData) -> Id<NSArray<NSImageRep>>;
#[method_id(@__retain_semantics Other imageRepWithData:)]
pub unsafe fn imageRepWithData(data: &NSData) -> Option<Id<Self>>;
#[method_id(@__retain_semantics Init initWithData:)]
pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Id<Self>>;
#[method(bitmapData)]
pub unsafe fn bitmapData(&self) -> *mut c_uchar;
#[method(getBitmapDataPlanes:)]
pub unsafe fn getBitmapDataPlanes(&self, data: NonNull<*mut c_uchar>);
#[method(isPlanar)]
pub unsafe fn isPlanar(&self) -> bool;
#[method(samplesPerPixel)]
pub unsafe fn samplesPerPixel(&self) -> NSInteger;
#[method(bitsPerPixel)]
pub unsafe fn bitsPerPixel(&self) -> NSInteger;
#[method(bytesPerRow)]
pub unsafe fn bytesPerRow(&self) -> NSInteger;
#[method(bytesPerPlane)]
pub unsafe fn bytesPerPlane(&self) -> NSInteger;
#[method(numberOfPlanes)]
pub unsafe fn numberOfPlanes(&self) -> NSInteger;
#[method(bitmapFormat)]
pub unsafe fn bitmapFormat(&self) -> NSBitmapFormat;
#[method(getCompression:factor:)]
pub unsafe fn getCompression_factor(
&self,
compression: *mut NSTIFFCompression,
factor: *mut c_float,
);
#[method(setCompression:factor:)]
pub unsafe fn setCompression_factor(&self, compression: NSTIFFCompression, factor: c_float);
#[method_id(@__retain_semantics Other TIFFRepresentation)]
pub unsafe fn TIFFRepresentation(&self) -> Option<Id<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationUsingCompression:factor:)]
pub unsafe fn TIFFRepresentationUsingCompression_factor(
&self,
comp: NSTIFFCompression,
factor: c_float,
) -> Option<Id<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationOfImageRepsInArray:)]
pub unsafe fn TIFFRepresentationOfImageRepsInArray(
array: &NSArray<NSImageRep>,
) -> Option<Id<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationOfImageRepsInArray:usingCompression:factor:)]
pub unsafe fn TIFFRepresentationOfImageRepsInArray_usingCompression_factor(
array: &NSArray<NSImageRep>,
comp: NSTIFFCompression,
factor: c_float,
) -> Option<Id<NSData>>;
#[method(getTIFFCompressionTypes:count:)]
pub unsafe fn getTIFFCompressionTypes_count(
list: NonNull<*mut NSTIFFCompression>,
num_types: NonNull<NSInteger>,
);
#[method_id(@__retain_semantics Other localizedNameForTIFFCompressionType:)]
pub unsafe fn localizedNameForTIFFCompressionType(
compression: NSTIFFCompression,
) -> Option<Id<NSString>>;
#[method(canBeCompressedUsing:)]
pub unsafe fn canBeCompressedUsing(&self, compression: NSTIFFCompression) -> bool;
#[cfg(feature = "NSColor")]
#[method(colorizeByMappingGray:toColor:blackMapping:whiteMapping:)]
pub unsafe fn colorizeByMappingGray_toColor_blackMapping_whiteMapping(
&self,
mid_point: CGFloat,
mid_point_color: Option<&NSColor>,
shadow_color: Option<&NSColor>,
light_color: Option<&NSColor>,
);
#[method_id(@__retain_semantics Init initForIncrementalLoad)]
pub unsafe fn initForIncrementalLoad(this: Allocated<Self>) -> Id<Self>;
#[method(incrementalLoadFromData:complete:)]
pub unsafe fn incrementalLoadFromData_complete(
&self,
data: &NSData,
complete: bool,
) -> NSInteger;
#[cfg(feature = "NSColor")]
#[method(setColor:atX:y:)]
pub unsafe fn setColor_atX_y(&self, color: &NSColor, x: NSInteger, y: NSInteger);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other colorAtX:y:)]
pub unsafe fn colorAtX_y(&self, x: NSInteger, y: NSInteger) -> Option<Id<NSColor>>;
#[method(getPixel:atX:y:)]
pub unsafe fn getPixel_atX_y(&self, p: NonNull<NSUInteger>, x: NSInteger, y: NSInteger);
#[method(setPixel:atX:y:)]
pub unsafe fn setPixel_atX_y(&self, p: NonNull<NSUInteger>, x: NSInteger, y: NSInteger);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorSpace)]
pub unsafe fn colorSpace(&self) -> Id<NSColorSpace>;
#[cfg(all(feature = "NSColorSpace", feature = "NSGraphics"))]
#[method_id(@__retain_semantics Other bitmapImageRepByConvertingToColorSpace:renderingIntent:)]
pub unsafe fn bitmapImageRepByConvertingToColorSpace_renderingIntent(
&self,
target_space: &NSColorSpace,
rendering_intent: NSColorRenderingIntent,
) -> Option<Id<NSBitmapImageRep>>;
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other bitmapImageRepByRetaggingWithColorSpace:)]
pub unsafe fn bitmapImageRepByRetaggingWithColorSpace(
&self,
new_space: &NSColorSpace,
) -> Option<Id<NSBitmapImageRep>>;
}
);
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
}
);
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics Other representationOfImageRepsInArray:usingType:properties:)]
pub unsafe fn representationOfImageRepsInArray_usingType_properties(
image_reps: &NSArray<NSImageRep>,
storage_type: NSBitmapImageFileType,
properties: &NSDictionary<NSBitmapImageRepPropertyKey, AnyObject>,
) -> Option<Id<NSData>>;
#[method_id(@__retain_semantics Other representationUsingType:properties:)]
pub unsafe fn representationUsingType_properties(
&self,
storage_type: NSBitmapImageFileType,
properties: &NSDictionary<NSBitmapImageRepPropertyKey, AnyObject>,
) -> Option<Id<NSData>>;
#[method(setProperty:withValue:)]
pub unsafe fn setProperty_withValue(
&self,
property: &NSBitmapImageRepPropertyKey,
value: Option<&AnyObject>,
);
#[method_id(@__retain_semantics Other valueForProperty:)]
pub unsafe fn valueForProperty(
&self,
property: &NSBitmapImageRepPropertyKey,
) -> Option<Id<AnyObject>>;
}
);
pub static NSTIFFFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::TIFF.0);
pub static NSBMPFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::BMP.0);
pub static NSGIFFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::GIF.0);
pub static NSJPEGFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::JPEG.0);
pub static NSPNGFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::PNG.0);
pub static NSJPEG2000FileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::JPEG2000.0);
pub static NSAlphaFirstBitmapFormat: NSBitmapFormat = NSBitmapFormat(NSBitmapFormat::AlphaFirst.0);
pub static NSAlphaNonpremultipliedBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::AlphaNonpremultiplied.0);
pub static NSFloatingPointSamplesBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::FloatingPointSamples.0);
pub static NS16BitLittleEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::SixteenBitLittleEndian.0);
pub static NS32BitLittleEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::ThirtyTwoBitLittleEndian.0);
pub static NS16BitBigEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::SixteenBitBigEndian.0);
pub static NS32BitBigEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::ThirtyTwoBitBigEndian.0);