use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
use objc2_core_image::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIColorProminence(pub NSInteger);
impl UIColorProminence {
#[doc(alias = "UIColorProminencePrimary")]
pub const Primary: Self = Self(0);
#[doc(alias = "UIColorProminenceSecondary")]
pub const Secondary: Self = Self(1);
#[doc(alias = "UIColorProminenceTertiary")]
pub const Tertiary: Self = Self(2);
#[doc(alias = "UIColorProminenceQuaternary")]
pub const Quaternary: Self = Self(3);
}
unsafe impl Encode for UIColorProminence {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIColorProminence {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIColor;
);
unsafe impl Send for UIColor {}
unsafe impl Sync for UIColor {}
extern_conformance!(
unsafe impl NSCoding for UIColor {}
);
extern_conformance!(
unsafe impl NSCopying for UIColor {}
);
unsafe impl CopyingHelper for UIColor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for UIColor {}
);
extern_conformance!(
unsafe impl NSSecureCoding for UIColor {}
);
impl UIColor {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithWhite:alpha:))]
#[unsafe(method_family = none)]
pub fn colorWithWhite_alpha(white: CGFloat, alpha: CGFloat) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithHue:saturation:brightness:alpha:))]
#[unsafe(method_family = none)]
pub fn colorWithHue_saturation_brightness_alpha(
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithRed:green:blue:alpha:))]
#[unsafe(method_family = none)]
pub fn colorWithRed_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithDisplayP3Red:green:blue:alpha:))]
#[unsafe(method_family = none)]
pub fn colorWithDisplayP3Red_green_blue_alpha(
display_p3_red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(colorWithCGColor:))]
#[unsafe(method_family = none)]
pub fn colorWithCGColor(cg_color: &CGColor) -> Retained<UIColor>;
#[cfg(feature = "UIImage")]
#[unsafe(method(colorWithPatternImage:))]
#[unsafe(method_family = none)]
pub fn colorWithPatternImage(image: &UIImage) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(colorWithCIColor:))]
#[unsafe(method_family = none)]
pub fn colorWithCIColor(ci_color: &CIColor) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithWhite:alpha:))]
#[unsafe(method_family = init)]
pub fn initWithWhite_alpha(
this: Allocated<Self>,
white: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithHue:saturation:brightness:alpha:))]
#[unsafe(method_family = init)]
pub fn initWithHue_saturation_brightness_alpha(
this: Allocated<Self>,
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithRed:green:blue:alpha:))]
#[unsafe(method_family = init)]
pub fn initWithRed_green_blue_alpha(
this: Allocated<Self>,
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithDisplayP3Red:green:blue:alpha:))]
#[unsafe(method_family = init)]
pub fn initWithDisplayP3Red_green_blue_alpha(
this: Allocated<Self>,
display_p3_red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(initWithCGColor:))]
#[unsafe(method_family = init)]
pub fn initWithCGColor(this: Allocated<Self>, cg_color: &CGColor) -> Retained<UIColor>;
#[cfg(feature = "UIImage")]
#[unsafe(method(initWithPatternImage:))]
#[unsafe(method_family = init)]
pub fn initWithPatternImage(this: Allocated<Self>, image: &UIImage) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(initWithCIColor:))]
#[unsafe(method_family = init)]
pub fn initWithCIColor(this: Allocated<Self>, ci_color: &CIColor) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithRed:green:blue:alpha:exposure:))]
#[unsafe(method_family = init)]
pub fn initWithRed_green_blue_alpha_exposure(
this: Allocated<Self>,
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
exposure: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithRed:green:blue:alpha:exposure:))]
#[unsafe(method_family = none)]
pub fn colorWithRed_green_blue_alpha_exposure(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
exposure: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithRed:green:blue:alpha:linearExposure:))]
#[unsafe(method_family = init)]
pub fn initWithRed_green_blue_alpha_linearExposure(
this: Allocated<Self>,
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
linear_exposure: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithRed:green:blue:alpha:linearExposure:))]
#[unsafe(method_family = none)]
pub fn colorWithRed_green_blue_alpha_linearExposure(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
linear_exposure: CGFloat,
) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorByApplyingContentHeadroom:))]
#[unsafe(method_family = none)]
pub fn colorByApplyingContentHeadroom(
&self,
content_headroom: CGFloat,
) -> Retained<UIColor>;
#[unsafe(method(blackColor))]
#[unsafe(method_family = none)]
pub fn blackColor() -> Retained<UIColor>;
#[unsafe(method(darkGrayColor))]
#[unsafe(method_family = none)]
pub fn darkGrayColor() -> Retained<UIColor>;
#[unsafe(method(lightGrayColor))]
#[unsafe(method_family = none)]
pub fn lightGrayColor() -> Retained<UIColor>;
#[unsafe(method(whiteColor))]
#[unsafe(method_family = none)]
pub fn whiteColor() -> Retained<UIColor>;
#[unsafe(method(grayColor))]
#[unsafe(method_family = none)]
pub fn grayColor() -> Retained<UIColor>;
#[unsafe(method(redColor))]
#[unsafe(method_family = none)]
pub fn redColor() -> Retained<UIColor>;
#[unsafe(method(greenColor))]
#[unsafe(method_family = none)]
pub fn greenColor() -> Retained<UIColor>;
#[unsafe(method(blueColor))]
#[unsafe(method_family = none)]
pub fn blueColor() -> Retained<UIColor>;
#[unsafe(method(cyanColor))]
#[unsafe(method_family = none)]
pub fn cyanColor() -> Retained<UIColor>;
#[unsafe(method(yellowColor))]
#[unsafe(method_family = none)]
pub fn yellowColor() -> Retained<UIColor>;
#[unsafe(method(magentaColor))]
#[unsafe(method_family = none)]
pub fn magentaColor() -> Retained<UIColor>;
#[unsafe(method(orangeColor))]
#[unsafe(method_family = none)]
pub fn orangeColor() -> Retained<UIColor>;
#[unsafe(method(purpleColor))]
#[unsafe(method_family = none)]
pub fn purpleColor() -> Retained<UIColor>;
#[unsafe(method(brownColor))]
#[unsafe(method_family = none)]
pub fn brownColor() -> Retained<UIColor>;
#[unsafe(method(clearColor))]
#[unsafe(method_family = none)]
pub fn clearColor() -> Retained<UIColor>;
#[unsafe(method(set))]
#[unsafe(method_family = none)]
pub fn set(&self);
#[unsafe(method(setFill))]
#[unsafe(method_family = none)]
pub fn setFill(&self);
#[unsafe(method(setStroke))]
#[unsafe(method_family = none)]
pub fn setStroke(&self);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(getWhite:alpha:))]
#[unsafe(method_family = none)]
pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(getHue:saturation:brightness:alpha:))]
#[unsafe(method_family = none)]
pub unsafe fn getHue_saturation_brightness_alpha(
&self,
hue: *mut CGFloat,
saturation: *mut CGFloat,
brightness: *mut CGFloat,
alpha: *mut CGFloat,
) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(getRed:green:blue:alpha:))]
#[unsafe(method_family = none)]
pub unsafe fn getRed_green_blue_alpha(
&self,
red: *mut CGFloat,
green: *mut CGFloat,
blue: *mut CGFloat,
alpha: *mut CGFloat,
) -> bool;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(colorWithAlphaComponent:))]
#[unsafe(method_family = none)]
pub fn colorWithAlphaComponent(&self, alpha: CGFloat) -> Retained<UIColor>;
#[cfg(feature = "objc2-core-graphics")]
#[unsafe(method(CGColor))]
#[unsafe(method_family = none)]
pub unsafe fn CGColor(&self) -> Retained<CGColor>;
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
#[unsafe(method(CIColor))]
#[unsafe(method_family = none)]
pub unsafe fn CIColor(&self) -> Retained<CIColor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(linearExposure))]
#[unsafe(method_family = none)]
pub unsafe fn linearExposure(&self) -> CGFloat;
#[unsafe(method(standardDynamicRangeColor))]
#[unsafe(method_family = none)]
pub unsafe fn standardDynamicRangeColor(&self) -> Retained<UIColor>;
);
}
impl UIColor {
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>;
);
}
impl DefaultRetained for UIColor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl UIColor {
extern_methods!();
}
extern_conformance!(
unsafe impl NSItemProviderReading for UIColor {}
);
extern_conformance!(
unsafe impl NSItemProviderWriting for UIColor {}
);
mod private_CIColorUIKitAdditions {
pub trait Sealed {}
}
#[doc(alias = "UIKitAdditions")]
pub unsafe trait CIColorUIKitAdditions:
ClassType + Sized + private_CIColorUIKitAdditions::Sealed
{
extern_methods!(
#[unsafe(method(initWithColor:))]
#[unsafe(method_family = init)]
fn initWithColor(this: Allocated<Self>, color: &UIColor) -> Retained<Self>;
);
}
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
impl private_CIColorUIKitAdditions::Sealed for CIColor {}
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
unsafe impl CIColorUIKitAdditions for CIColor {}
impl UIColor {
extern_methods!(
#[unsafe(method(colorNamed:))]
#[unsafe(method_family = none)]
pub fn colorNamed(name: &NSString) -> Option<Retained<UIColor>>;
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(colorNamed:inBundle:compatibleWithTraitCollection:))]
#[unsafe(method_family = none)]
pub fn colorNamed_inBundle_compatibleWithTraitCollection(
name: &NSString,
bundle: Option<&NSBundle>,
trait_collection: Option<&UITraitCollection>,
) -> Option<Retained<UIColor>>;
);
}
impl UIColor {
extern_methods!(
#[cfg(all(feature = "UITraitCollection", feature = "block2"))]
#[unsafe(method(colorWithDynamicProvider:))]
#[unsafe(method_family = none)]
pub unsafe fn colorWithDynamicProvider(
dynamic_provider: &block2::DynBlock<
dyn Fn(NonNull<UITraitCollection>) -> NonNull<UIColor>,
>,
) -> Retained<UIColor>;
#[cfg(all(feature = "UITraitCollection", feature = "block2"))]
#[unsafe(method(initWithDynamicProvider:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDynamicProvider(
this: Allocated<Self>,
dynamic_provider: &block2::DynBlock<
dyn Fn(NonNull<UITraitCollection>) -> NonNull<UIColor>,
>,
) -> Retained<UIColor>;
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(resolvedColorWithTraitCollection:))]
#[unsafe(method_family = none)]
pub fn resolvedColorWithTraitCollection(
&self,
trait_collection: &UITraitCollection,
) -> Retained<UIColor>;
);
}
impl UIColor {
extern_methods!(
#[unsafe(method(colorWithProminence:))]
#[unsafe(method_family = none)]
pub fn colorWithProminence(&self, prominence: UIColorProminence) -> Retained<UIColor>;
#[unsafe(method(prominence))]
#[unsafe(method_family = none)]
pub unsafe fn prominence(&self) -> UIColorProminence;
);
}