objc2-pencil-kit 0.3.2

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

use crate::*;

extern_class!(
    /// The data model value representing a stroke in a `PKDrawing`.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkstroke?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKStroke;
);

unsafe impl Send for PKStroke {}

unsafe impl Sync for PKStroke {}

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

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

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

impl PKStroke {
    extern_methods!(
        #[cfg(all(
            feature = "PKInk",
            feature = "PKStrokePath",
            feature = "objc2-app-kit",
            feature = "objc2-core-foundation"
        ))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(initWithInk:strokePath:transform:mask:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInk_strokePath_transform_mask(
            this: Allocated<Self>,
            ink: &PKInk,
            stroke_path: &PKStrokePath,
            transform: CGAffineTransform,
            mask: Option<&NSBezierPath>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "PKInk",
            feature = "PKStrokePath",
            feature = "objc2-app-kit",
            feature = "objc2-core-foundation"
        ))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(initWithInk:strokePath:transform:mask:randomSeed:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInk_strokePath_transform_mask_randomSeed(
            this: Allocated<Self>,
            ink: &PKInk,
            stroke_path: &PKStrokePath,
            transform: CGAffineTransform,
            mask: Option<&NSBezierPath>,
            random_seed: u32,
        ) -> Retained<Self>;

        #[cfg(feature = "PKInk")]
        /// The ink used to render this stroke.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(ink))]
        #[unsafe(method_family = none)]
        pub unsafe fn ink(&self) -> Retained<PKInk>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The affine transform of the stroke when rendered.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(transform))]
        #[unsafe(method_family = none)]
        pub unsafe fn transform(&self) -> CGAffineTransform;

        #[cfg(feature = "PKStrokePath")]
        /// The B-spline path that describes this stroke.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Retained<PKStrokePath>;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(mask))]
        #[unsafe(method_family = none)]
        pub unsafe fn mask(&self) -> Option<Retained<NSBezierPath>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The bounds of the rendered stroke.
        /// This includes the width
        /// &
        /// ink of the stroke after the transform
        /// is applied.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(renderBounds))]
        #[unsafe(method_family = none)]
        pub unsafe fn renderBounds(&self) -> CGRect;

        #[cfg(feature = "PKFloatRange")]
        /// These are the parametric parameter ranges of points in `strokePath`
        /// that intersect the stroke's mask.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(maskedPathRanges))]
        #[unsafe(method_family = none)]
        pub unsafe fn maskedPathRanges(&self) -> Retained<NSArray<PKFloatRange>>;

        /// The random seed for drawing strokes that use randomized effects.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(randomSeed))]
        #[unsafe(method_family = none)]
        pub unsafe fn randomSeed(&self) -> u32;

        #[cfg(feature = "PKContentVersion")]
        /// The PencilKit version required to use this stroke.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(requiredContentVersion))]
        #[unsafe(method_family = none)]
        pub unsafe fn requiredContentVersion(&self) -> PKContentVersion;
    );
}

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