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")]
#[cfg(target_vendor = "apple")]
use objc2_core_graphics::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineCapStyle(pub NSUInteger);
impl NSLineCapStyle {
#[doc(alias = "NSLineCapStyleButt")]
pub const Butt: Self = Self(0);
#[doc(alias = "NSLineCapStyleRound")]
pub const Round: Self = Self(1);
#[doc(alias = "NSLineCapStyleSquare")]
pub const Square: Self = Self(2);
}
unsafe impl Encode for NSLineCapStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineCapStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineJoinStyle(pub NSUInteger);
impl NSLineJoinStyle {
#[doc(alias = "NSLineJoinStyleMiter")]
pub const Miter: Self = Self(0);
#[doc(alias = "NSLineJoinStyleRound")]
pub const Round: Self = Self(1);
#[doc(alias = "NSLineJoinStyleBevel")]
pub const Bevel: Self = Self(2);
}
unsafe impl Encode for NSLineJoinStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineJoinStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWindingRule(pub NSUInteger);
impl NSWindingRule {
#[doc(alias = "NSWindingRuleNonZero")]
pub const NonZero: Self = Self(0);
#[doc(alias = "NSWindingRuleEvenOdd")]
pub const EvenOdd: Self = Self(1);
}
unsafe impl Encode for NSWindingRule {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSWindingRule {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBezierPathElement(pub NSUInteger);
impl NSBezierPathElement {
#[doc(alias = "NSBezierPathElementMoveTo")]
pub const MoveTo: Self = Self(0);
#[doc(alias = "NSBezierPathElementLineTo")]
pub const LineTo: Self = Self(1);
#[doc(alias = "NSBezierPathElementCubicCurveTo")]
pub const CubicCurveTo: Self = Self(2);
#[doc(alias = "NSBezierPathElementClosePath")]
pub const ClosePath: Self = Self(3);
#[doc(alias = "NSBezierPathElementQuadraticCurveTo")]
pub const QuadraticCurveTo: Self = Self(4);
#[doc(alias = "NSBezierPathElementCurveTo")]
#[deprecated]
pub const CurveTo: Self = Self(NSBezierPathElement::CubicCurveTo.0);
}
unsafe impl Encode for NSBezierPathElement {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBezierPathElement {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSBezierPath;
);
extern_conformance!(
unsafe impl NSCoding for NSBezierPath {}
);
extern_conformance!(
unsafe impl NSCopying for NSBezierPath {}
);
unsafe impl CopyingHelper for NSBezierPath {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSBezierPath {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSBezierPath {}
);
impl NSBezierPath {
extern_methods!(
#[unsafe(method(bezierPath))]
#[unsafe(method_family = none)]
pub fn bezierPath() -> Retained<NSBezierPath>;
#[unsafe(method(bezierPathWithRect:))]
#[unsafe(method_family = none)]
pub fn bezierPathWithRect(rect: NSRect) -> Retained<NSBezierPath>;
#[unsafe(method(bezierPathWithOvalInRect:))]
#[unsafe(method_family = none)]
pub fn bezierPathWithOvalInRect(rect: NSRect) -> Retained<NSBezierPath>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(bezierPathWithRoundedRect:xRadius:yRadius:))]
#[unsafe(method_family = none)]
pub fn bezierPathWithRoundedRect_xRadius_yRadius(
rect: NSRect,
x_radius: CGFloat,
y_radius: CGFloat,
) -> Retained<NSBezierPath>;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(bezierPathWithCGPath:))]
#[unsafe(method_family = none)]
pub fn bezierPathWithCGPath(cg_path: &CGPath) -> Retained<NSBezierPath>;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(CGPath))]
#[unsafe(method_family = none)]
pub fn CGPath(&self) -> Retained<CGPath>;
#[cfg(feature = "objc2-core-graphics")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(setCGPath:))]
#[unsafe(method_family = none)]
pub fn setCGPath(&self, cg_path: &CGPath);
#[unsafe(method(fillRect:))]
#[unsafe(method_family = none)]
pub fn fillRect(rect: NSRect);
#[unsafe(method(strokeRect:))]
#[unsafe(method_family = none)]
pub fn strokeRect(rect: NSRect);
#[unsafe(method(clipRect:))]
#[unsafe(method_family = none)]
pub fn clipRect(rect: NSRect);
#[unsafe(method(strokeLineFromPoint:toPoint:))]
#[unsafe(method_family = none)]
pub fn strokeLineFromPoint_toPoint(point1: NSPoint, point2: NSPoint);
#[unsafe(method(drawPackedGlyphs:atPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn drawPackedGlyphs_atPoint(packed_glyphs: NonNull<c_char>, point: NSPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(defaultMiterLimit))]
#[unsafe(method_family = none)]
pub fn defaultMiterLimit() -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDefaultMiterLimit:))]
#[unsafe(method_family = none)]
pub fn setDefaultMiterLimit(default_miter_limit: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(defaultFlatness))]
#[unsafe(method_family = none)]
pub fn defaultFlatness() -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDefaultFlatness:))]
#[unsafe(method_family = none)]
pub fn setDefaultFlatness(default_flatness: CGFloat);
#[unsafe(method(defaultWindingRule))]
#[unsafe(method_family = none)]
pub fn defaultWindingRule() -> NSWindingRule;
#[unsafe(method(setDefaultWindingRule:))]
#[unsafe(method_family = none)]
pub fn setDefaultWindingRule(default_winding_rule: NSWindingRule);
#[unsafe(method(defaultLineCapStyle))]
#[unsafe(method_family = none)]
pub fn defaultLineCapStyle() -> NSLineCapStyle;
#[unsafe(method(setDefaultLineCapStyle:))]
#[unsafe(method_family = none)]
pub fn setDefaultLineCapStyle(default_line_cap_style: NSLineCapStyle);
#[unsafe(method(defaultLineJoinStyle))]
#[unsafe(method_family = none)]
pub fn defaultLineJoinStyle() -> NSLineJoinStyle;
#[unsafe(method(setDefaultLineJoinStyle:))]
#[unsafe(method_family = none)]
pub fn setDefaultLineJoinStyle(default_line_join_style: NSLineJoinStyle);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(defaultLineWidth))]
#[unsafe(method_family = none)]
pub fn defaultLineWidth() -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDefaultLineWidth:))]
#[unsafe(method_family = none)]
pub fn setDefaultLineWidth(default_line_width: CGFloat);
#[unsafe(method(moveToPoint:))]
#[unsafe(method_family = none)]
pub fn moveToPoint(&self, point: NSPoint);
#[unsafe(method(lineToPoint:))]
#[unsafe(method_family = none)]
pub fn lineToPoint(&self, point: NSPoint);
#[unsafe(method(curveToPoint:controlPoint1:controlPoint2:))]
#[unsafe(method_family = none)]
pub fn curveToPoint_controlPoint1_controlPoint2(
&self,
end_point: NSPoint,
control_point1: NSPoint,
control_point2: NSPoint,
);
#[unsafe(method(curveToPoint:controlPoint:))]
#[unsafe(method_family = none)]
pub fn curveToPoint_controlPoint(&self, end_point: NSPoint, control_point: NSPoint);
#[unsafe(method(closePath))]
#[unsafe(method_family = none)]
pub fn closePath(&self);
#[unsafe(method(removeAllPoints))]
#[unsafe(method_family = none)]
pub fn removeAllPoints(&self);
#[unsafe(method(relativeMoveToPoint:))]
#[unsafe(method_family = none)]
pub fn relativeMoveToPoint(&self, point: NSPoint);
#[unsafe(method(relativeLineToPoint:))]
#[unsafe(method_family = none)]
pub fn relativeLineToPoint(&self, point: NSPoint);
#[unsafe(method(relativeCurveToPoint:controlPoint1:controlPoint2:))]
#[unsafe(method_family = none)]
pub fn relativeCurveToPoint_controlPoint1_controlPoint2(
&self,
end_point: NSPoint,
control_point1: NSPoint,
control_point2: NSPoint,
);
#[unsafe(method(relativeCurveToPoint:controlPoint:))]
#[unsafe(method_family = none)]
pub fn relativeCurveToPoint_controlPoint(&self, end_point: NSPoint, control_point: NSPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineWidth))]
#[unsafe(method_family = none)]
pub fn lineWidth(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineWidth:))]
#[unsafe(method_family = none)]
pub fn setLineWidth(&self, line_width: CGFloat);
#[unsafe(method(lineCapStyle))]
#[unsafe(method_family = none)]
pub fn lineCapStyle(&self) -> NSLineCapStyle;
#[unsafe(method(setLineCapStyle:))]
#[unsafe(method_family = none)]
pub fn setLineCapStyle(&self, line_cap_style: NSLineCapStyle);
#[unsafe(method(lineJoinStyle))]
#[unsafe(method_family = none)]
pub fn lineJoinStyle(&self) -> NSLineJoinStyle;
#[unsafe(method(setLineJoinStyle:))]
#[unsafe(method_family = none)]
pub fn setLineJoinStyle(&self, line_join_style: NSLineJoinStyle);
#[unsafe(method(windingRule))]
#[unsafe(method_family = none)]
pub fn windingRule(&self) -> NSWindingRule;
#[unsafe(method(setWindingRule:))]
#[unsafe(method_family = none)]
pub fn setWindingRule(&self, winding_rule: NSWindingRule);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(miterLimit))]
#[unsafe(method_family = none)]
pub fn miterLimit(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setMiterLimit:))]
#[unsafe(method_family = none)]
pub fn setMiterLimit(&self, miter_limit: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(flatness))]
#[unsafe(method_family = none)]
pub fn flatness(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setFlatness:))]
#[unsafe(method_family = none)]
pub fn setFlatness(&self, flatness: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(getLineDash:count:phase:))]
#[unsafe(method_family = none)]
pub unsafe fn getLineDash_count_phase(
&self,
pattern: *mut CGFloat,
count: *mut NSInteger,
phase: *mut CGFloat,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineDash:count:phase:))]
#[unsafe(method_family = none)]
pub unsafe fn setLineDash_count_phase(
&self,
pattern: *const CGFloat,
count: NSInteger,
phase: CGFloat,
);
#[unsafe(method(stroke))]
#[unsafe(method_family = none)]
pub fn stroke(&self);
#[unsafe(method(fill))]
#[unsafe(method_family = none)]
pub fn fill(&self);
#[unsafe(method(addClip))]
#[unsafe(method_family = none)]
pub fn addClip(&self);
#[unsafe(method(setClip))]
#[unsafe(method_family = none)]
pub fn setClip(&self);
#[unsafe(method(bezierPathByFlatteningPath))]
#[unsafe(method_family = none)]
pub fn bezierPathByFlatteningPath(&self) -> Retained<NSBezierPath>;
#[unsafe(method(bezierPathByReversingPath))]
#[unsafe(method_family = none)]
pub fn bezierPathByReversingPath(&self) -> Retained<NSBezierPath>;
#[unsafe(method(transformUsingAffineTransform:))]
#[unsafe(method_family = none)]
pub fn transformUsingAffineTransform(&self, transform: &NSAffineTransform);
#[unsafe(method(isEmpty))]
#[unsafe(method_family = none)]
pub fn isEmpty(&self) -> bool;
#[unsafe(method(currentPoint))]
#[unsafe(method_family = none)]
pub fn currentPoint(&self) -> NSPoint;
#[unsafe(method(controlPointBounds))]
#[unsafe(method_family = none)]
pub fn controlPointBounds(&self) -> NSRect;
#[unsafe(method(bounds))]
#[unsafe(method_family = none)]
pub fn bounds(&self) -> NSRect;
#[unsafe(method(elementCount))]
#[unsafe(method_family = none)]
pub fn elementCount(&self) -> NSInteger;
#[unsafe(method(elementAtIndex:associatedPoints:))]
#[unsafe(method_family = none)]
pub unsafe fn elementAtIndex_associatedPoints(
&self,
index: NSInteger,
points: NSPointArray,
) -> NSBezierPathElement;
#[unsafe(method(elementAtIndex:))]
#[unsafe(method_family = none)]
pub fn elementAtIndex(&self, index: NSInteger) -> NSBezierPathElement;
#[unsafe(method(setAssociatedPoints:atIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn setAssociatedPoints_atIndex(&self, points: NSPointArray, index: NSInteger);
#[unsafe(method(appendBezierPath:))]
#[unsafe(method_family = none)]
pub fn appendBezierPath(&self, path: &NSBezierPath);
#[unsafe(method(appendBezierPathWithRect:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithRect(&self, rect: NSRect);
#[unsafe(method(appendBezierPathWithPoints:count:))]
#[unsafe(method_family = none)]
pub unsafe fn appendBezierPathWithPoints_count(
&self,
points: NSPointArray,
count: NSInteger,
);
#[unsafe(method(appendBezierPathWithOvalInRect:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithOvalInRect(&self, rect: NSRect);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_clockwise(
&self,
center: NSPoint,
radius: CGFloat,
start_angle: CGFloat,
end_angle: CGFloat,
clockwise: bool,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle(
&self,
center: NSPoint,
radius: CGFloat,
start_angle: CGFloat,
end_angle: CGFloat,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(appendBezierPathWithArcFromPoint:toPoint:radius:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithArcFromPoint_toPoint_radius(
&self,
point1: NSPoint,
point2: NSPoint,
radius: CGFloat,
);
#[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
#[cfg(target_vendor = "apple")]
#[unsafe(method(appendBezierPathWithCGGlyph:inFont:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithCGGlyph_inFont(&self, glyph: CGGlyph, font: &NSFont);
#[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
#[cfg(target_vendor = "apple")]
#[unsafe(method(appendBezierPathWithCGGlyphs:count:inFont:))]
#[unsafe(method_family = none)]
pub unsafe fn appendBezierPathWithCGGlyphs_count_inFont(
&self,
glyphs: NonNull<CGGlyph>,
count: NSInteger,
font: &NSFont,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(appendBezierPathWithRoundedRect:xRadius:yRadius:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithRoundedRect_xRadius_yRadius(
&self,
rect: NSRect,
x_radius: CGFloat,
y_radius: CGFloat,
);
#[unsafe(method(containsPoint:))]
#[unsafe(method_family = none)]
pub fn containsPoint(&self, point: NSPoint) -> bool;
);
}
impl NSBezierPath {
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 NSBezierPath {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl NSBezierPath {
extern_methods!(
#[deprecated]
#[unsafe(method(cachesBezierPath))]
#[unsafe(method_family = none)]
pub fn cachesBezierPath(&self) -> bool;
#[deprecated]
#[unsafe(method(setCachesBezierPath:))]
#[unsafe(method_family = none)]
pub fn setCachesBezierPath(&self, flag: bool);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -appendBezierPathWithCGGlyph:inFont: instead"]
#[unsafe(method(appendBezierPathWithGlyph:inFont:))]
#[unsafe(method_family = none)]
pub fn appendBezierPathWithGlyph_inFont(&self, glyph: NSGlyph, font: &NSFont);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -appendBezierPathWithCGGlyphs:count:inFont: instead"]
#[unsafe(method(appendBezierPathWithGlyphs:count:inFont:))]
#[unsafe(method_family = none)]
pub unsafe fn appendBezierPathWithGlyphs_count_inFont(
&self,
glyphs: NonNull<NSGlyph>,
count: NSInteger,
font: &NSFont,
);
#[deprecated = "Use -appendBezierPathWithCGGlyphs:count:inFont: instead"]
#[unsafe(method(appendBezierPathWithPackedGlyphs:))]
#[unsafe(method_family = none)]
pub unsafe fn appendBezierPathWithPackedGlyphs(&self, packed_glyphs: NonNull<c_char>);
);
}
#[deprecated]
pub static NSButtLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Butt.0);
#[deprecated]
pub static NSRoundLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Round.0);
#[deprecated]
pub static NSSquareLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Square.0);
#[deprecated]
pub static NSMiterLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Miter.0);
#[deprecated]
pub static NSRoundLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Round.0);
#[deprecated]
pub static NSBevelLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Bevel.0);
#[deprecated]
pub static NSNonZeroWindingRule: NSWindingRule = NSWindingRule(NSWindingRule::NonZero.0);
#[deprecated]
pub static NSEvenOddWindingRule: NSWindingRule = NSWindingRule(NSWindingRule::EvenOdd.0);
#[deprecated]
pub static NSMoveToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::MoveTo.0);
#[deprecated]
pub static NSLineToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::LineTo.0);
#[deprecated]
pub static NSCurveToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::CurveTo.0);
#[deprecated]
pub static NSClosePathBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::ClosePath.0);