use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[cfg(all(feature = "UIGraphicsRenderer", feature = "block2"))]
pub type UIGraphicsImageDrawingActions =
*mut block2::DynBlock<dyn Fn(NonNull<UIGraphicsImageRendererContext>)>;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIGraphicsImageRendererFormatRange(pub NSInteger);
impl UIGraphicsImageRendererFormatRange {
#[doc(alias = "UIGraphicsImageRendererFormatRangeUnspecified")]
pub const Unspecified: Self = Self(-1);
#[doc(alias = "UIGraphicsImageRendererFormatRangeAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "UIGraphicsImageRendererFormatRangeExtended")]
pub const Extended: Self = Self(1);
#[doc(alias = "UIGraphicsImageRendererFormatRangeStandard")]
pub const Standard: Self = Self(2);
}
unsafe impl Encode for UIGraphicsImageRendererFormatRange {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIGraphicsImageRendererFormatRange {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UIGraphicsRendererFormat, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsImageRendererFormat;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSCopying for UIGraphicsImageRendererFormat {}
);
#[cfg(feature = "UIGraphicsRenderer")]
unsafe impl CopyingHelper for UIGraphicsImageRendererFormat {
type Result = Self;
}
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsImageRendererFormat {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRendererFormat {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(scale))]
#[unsafe(method_family = none)]
pub fn scale(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setScale:))]
#[unsafe(method_family = none)]
pub fn setScale(&self, scale: CGFloat);
#[unsafe(method(opaque))]
#[unsafe(method_family = none)]
pub fn opaque(&self) -> bool;
#[unsafe(method(setOpaque:))]
#[unsafe(method_family = none)]
pub fn setOpaque(&self, opaque: bool);
#[deprecated = "Use the preferredRange property instead"]
#[unsafe(method(prefersExtendedRange))]
#[unsafe(method_family = none)]
pub fn prefersExtendedRange(&self) -> bool;
#[deprecated = "Use the preferredRange property instead"]
#[unsafe(method(setPrefersExtendedRange:))]
#[unsafe(method_family = none)]
pub fn setPrefersExtendedRange(&self, prefers_extended_range: bool);
#[unsafe(method(supportsHighDynamicRange))]
#[unsafe(method_family = none)]
pub fn supportsHighDynamicRange(&self) -> bool;
#[unsafe(method(preferredRange))]
#[unsafe(method_family = none)]
pub fn preferredRange(&self) -> UIGraphicsImageRendererFormatRange;
#[unsafe(method(setPreferredRange:))]
#[unsafe(method_family = none)]
pub fn setPreferredRange(&self, preferred_range: UIGraphicsImageRendererFormatRange);
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(formatForTraitCollection:))]
#[unsafe(method_family = none)]
pub fn formatForTraitCollection(trait_collection: &UITraitCollection) -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRendererFormat {
extern_methods!(
#[deprecated]
#[unsafe(method(defaultFormat))]
#[unsafe(method_family = none)]
pub fn defaultFormat() -> Retained<Self>;
#[unsafe(method(preferredFormat))]
#[unsafe(method_family = none)]
pub fn preferredFormat() -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRendererFormat {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsImageRendererFormat {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(UIGraphicsRendererContext, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsImageRendererContext;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsImageRendererContext {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRendererContext {
extern_methods!(
#[cfg(feature = "UIImage")]
#[unsafe(method(currentImage))]
#[unsafe(method_family = none)]
pub fn currentImage(&self) -> Retained<UIImage>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRendererContext {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsImageRendererContext {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(UIGraphicsRenderer, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsImageRenderer;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsImageRenderer {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRenderer {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithSize:))]
#[unsafe(method_family = init)]
pub fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithSize:format:))]
#[unsafe(method_family = init)]
pub fn initWithSize_format(
this: Allocated<Self>,
size: CGSize,
format: &UIGraphicsImageRendererFormat,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithBounds:format:))]
#[unsafe(method_family = init)]
pub fn initWithBounds_format(
this: Allocated<Self>,
bounds: CGRect,
format: &UIGraphicsImageRendererFormat,
) -> Retained<Self>;
#[cfg(all(feature = "UIImage", feature = "block2"))]
#[unsafe(method(imageWithActions:))]
#[unsafe(method_family = none)]
pub unsafe fn imageWithActions(
&self,
actions: UIGraphicsImageDrawingActions,
) -> Retained<UIImage>;
#[cfg(feature = "block2")]
#[unsafe(method(PNGDataWithActions:))]
#[unsafe(method_family = none)]
pub unsafe fn PNGDataWithActions(
&self,
actions: UIGraphicsImageDrawingActions,
) -> Retained<NSData>;
#[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
#[unsafe(method(JPEGDataWithCompressionQuality:actions:))]
#[unsafe(method_family = none)]
pub unsafe fn JPEGDataWithCompressionQuality_actions(
&self,
compression_quality: CGFloat,
actions: UIGraphicsImageDrawingActions,
) -> Retained<NSData>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRenderer {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithBounds:))]
#[unsafe(method_family = init)]
pub fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsImageRenderer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsImageRenderer {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}