objc2-sprite-kit 0.3.2

Bindings to the SpriteKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skregion?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKRegion;
);

extern_conformance!(
    unsafe impl NSCoding for SKRegion {}
);

extern_conformance!(
    unsafe impl NSCopying for SKRegion {}
);

unsafe impl CopyingHelper for SKRegion {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for SKRegion {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for SKRegion {}
);

impl SKRegion {
    extern_methods!(
        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Option<Retained<CGPath>>;

        /// A shared infinite region
        #[unsafe(method(infiniteRegion))]
        #[unsafe(method_family = none)]
        pub unsafe fn infiniteRegion() -> Retained<Self>;

        /// Create a circular region with radius
        #[unsafe(method(initWithRadius:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRadius(this: Allocated<Self>, radius: c_float) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a rectangular region of size
        #[unsafe(method(initWithSize:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Create a region bounded by a CGPath. Note that this option can be
        /// costly to evaluate.
        #[unsafe(method(initWithPath:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPath(this: Allocated<Self>, path: &CGPath) -> Retained<Self>;

        /// Create a new region that is the inverse of the current region.
        /// The inverse of the infiniteRegion is an empty region.
        /// Subclasses of SKRegion need to provide an implementation of inverseRegion.
        #[unsafe(method(inverseRegion))]
        #[unsafe(method_family = none)]
        pub unsafe fn inverseRegion(&self) -> Retained<Self>;

        /// Create a new region that is the original region plus the supplied region
        #[unsafe(method(regionByUnionWithRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionByUnionWithRegion(&self, region: &SKRegion) -> Retained<Self>;

        /// Create a new region that is the original region minus the supplied region
        #[unsafe(method(regionByDifferenceFromRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionByDifferenceFromRegion(&self, region: &SKRegion) -> Retained<Self>;

        /// Create a new region that is the region covered by the original region and the supplied region
        #[unsafe(method(regionByIntersectionWithRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionByIntersectionWithRegion(&self, region: &SKRegion) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Test for containment
        #[unsafe(method(containsPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsPoint(&self, point: CGPoint) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl SKRegion {
    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>;
    );
}