#[repr(C)]pub struct NSBezierPath { /* private fields */ }
NSBezierPath
only.Expand description
Implementations§
Source§impl NSBezierPath
impl NSBezierPath
pub unsafe fn bezierPath() -> Retained<NSBezierPath>
pub unsafe fn bezierPathWithRect(rect: NSRect) -> Retained<NSBezierPath>
pub unsafe fn bezierPathWithOvalInRect(rect: NSRect) -> Retained<NSBezierPath>
pub unsafe fn bezierPathWithRoundedRect_xRadius_yRadius( rect: NSRect, x_radius: CGFloat, y_radius: CGFloat, ) -> Retained<NSBezierPath>
objc2-core-foundation
only.pub unsafe fn bezierPathWithCGPath(cg_path: &CGPath) -> Retained<NSBezierPath>
objc2-core-graphics
and Apple only.pub unsafe fn CGPath(&self) -> Retained<CGPath>
objc2-core-graphics
and Apple only.Sourcepub unsafe fn setCGPath(&self, cg_path: &CGPath)
Available on crate feature objc2-core-graphics
and Apple only.
pub unsafe fn setCGPath(&self, cg_path: &CGPath)
objc2-core-graphics
and Apple only.Setter for CGPath
.
pub unsafe fn fillRect(rect: NSRect)
pub unsafe fn strokeRect(rect: NSRect)
pub unsafe fn clipRect(rect: NSRect)
pub unsafe fn strokeLineFromPoint_toPoint(point1: NSPoint, point2: NSPoint)
pub unsafe fn drawPackedGlyphs_atPoint( packed_glyphs: NonNull<c_char>, point: NSPoint, )
pub unsafe fn defaultMiterLimit() -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setDefaultMiterLimit(default_miter_limit: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setDefaultMiterLimit(default_miter_limit: CGFloat)
objc2-core-foundation
only.Setter for defaultMiterLimit
.
pub unsafe fn defaultFlatness() -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setDefaultFlatness(default_flatness: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setDefaultFlatness(default_flatness: CGFloat)
objc2-core-foundation
only.Setter for defaultFlatness
.
pub unsafe fn defaultWindingRule() -> NSWindingRule
Sourcepub unsafe fn setDefaultWindingRule(default_winding_rule: NSWindingRule)
pub unsafe fn setDefaultWindingRule(default_winding_rule: NSWindingRule)
Setter for defaultWindingRule
.
pub unsafe fn defaultLineCapStyle() -> NSLineCapStyle
Sourcepub unsafe fn setDefaultLineCapStyle(default_line_cap_style: NSLineCapStyle)
pub unsafe fn setDefaultLineCapStyle(default_line_cap_style: NSLineCapStyle)
Setter for defaultLineCapStyle
.
pub unsafe fn defaultLineJoinStyle() -> NSLineJoinStyle
Sourcepub unsafe fn setDefaultLineJoinStyle(default_line_join_style: NSLineJoinStyle)
pub unsafe fn setDefaultLineJoinStyle(default_line_join_style: NSLineJoinStyle)
Setter for defaultLineJoinStyle
.
pub unsafe fn defaultLineWidth() -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setDefaultLineWidth(default_line_width: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setDefaultLineWidth(default_line_width: CGFloat)
objc2-core-foundation
only.Setter for defaultLineWidth
.
pub unsafe fn moveToPoint(&self, point: NSPoint)
pub unsafe fn lineToPoint(&self, point: NSPoint)
pub unsafe fn curveToPoint_controlPoint1_controlPoint2( &self, end_point: NSPoint, control_point1: NSPoint, control_point2: NSPoint, )
pub unsafe fn curveToPoint_controlPoint( &self, end_point: NSPoint, control_point: NSPoint, )
pub unsafe fn closePath(&self)
pub unsafe fn removeAllPoints(&self)
pub unsafe fn relativeMoveToPoint(&self, point: NSPoint)
pub unsafe fn relativeLineToPoint(&self, point: NSPoint)
pub unsafe fn relativeCurveToPoint_controlPoint1_controlPoint2( &self, end_point: NSPoint, control_point1: NSPoint, control_point2: NSPoint, )
pub unsafe fn relativeCurveToPoint_controlPoint( &self, end_point: NSPoint, control_point: NSPoint, )
pub unsafe fn lineWidth(&self) -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setLineWidth(&self, line_width: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setLineWidth(&self, line_width: CGFloat)
objc2-core-foundation
only.Setter for lineWidth
.
pub unsafe fn lineCapStyle(&self) -> NSLineCapStyle
Sourcepub unsafe fn setLineCapStyle(&self, line_cap_style: NSLineCapStyle)
pub unsafe fn setLineCapStyle(&self, line_cap_style: NSLineCapStyle)
Setter for lineCapStyle
.
pub unsafe fn lineJoinStyle(&self) -> NSLineJoinStyle
Sourcepub unsafe fn setLineJoinStyle(&self, line_join_style: NSLineJoinStyle)
pub unsafe fn setLineJoinStyle(&self, line_join_style: NSLineJoinStyle)
Setter for lineJoinStyle
.
pub unsafe fn windingRule(&self) -> NSWindingRule
Sourcepub unsafe fn setWindingRule(&self, winding_rule: NSWindingRule)
pub unsafe fn setWindingRule(&self, winding_rule: NSWindingRule)
Setter for windingRule
.
pub unsafe fn miterLimit(&self) -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setMiterLimit(&self, miter_limit: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setMiterLimit(&self, miter_limit: CGFloat)
objc2-core-foundation
only.Setter for miterLimit
.
pub unsafe fn flatness(&self) -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setFlatness(&self, flatness: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setFlatness(&self, flatness: CGFloat)
objc2-core-foundation
only.Setter for flatness
.
pub unsafe fn getLineDash_count_phase( &self, pattern: *mut CGFloat, count: *mut NSInteger, phase: *mut CGFloat, )
objc2-core-foundation
only.pub unsafe fn setLineDash_count_phase( &self, pattern: *const CGFloat, count: NSInteger, phase: CGFloat, )
objc2-core-foundation
only.pub unsafe fn stroke(&self)
pub unsafe fn fill(&self)
pub unsafe fn addClip(&self)
pub unsafe fn setClip(&self)
pub unsafe fn bezierPathByFlatteningPath(&self) -> Retained<NSBezierPath>
pub unsafe fn bezierPathByReversingPath(&self) -> Retained<NSBezierPath>
pub unsafe fn transformUsingAffineTransform( &self, transform: &NSAffineTransform, )
pub unsafe fn isEmpty(&self) -> bool
pub unsafe fn currentPoint(&self) -> NSPoint
pub unsafe fn controlPointBounds(&self) -> NSRect
pub unsafe fn bounds(&self) -> NSRect
pub unsafe fn elementCount(&self) -> NSInteger
pub unsafe fn elementAtIndex_associatedPoints( &self, index: NSInteger, points: NSPointArray, ) -> NSBezierPathElement
pub unsafe fn elementAtIndex(&self, index: NSInteger) -> NSBezierPathElement
pub unsafe fn setAssociatedPoints_atIndex( &self, points: NSPointArray, index: NSInteger, )
pub unsafe fn appendBezierPath(&self, path: &NSBezierPath)
pub unsafe fn appendBezierPathWithRect(&self, rect: NSRect)
pub unsafe fn appendBezierPathWithPoints_count( &self, points: NSPointArray, count: NSInteger, )
pub unsafe fn appendBezierPathWithOvalInRect(&self, rect: NSRect)
pub unsafe fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_clockwise( &self, center: NSPoint, radius: CGFloat, start_angle: CGFloat, end_angle: CGFloat, clockwise: bool, )
objc2-core-foundation
only.pub unsafe fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle( &self, center: NSPoint, radius: CGFloat, start_angle: CGFloat, end_angle: CGFloat, )
objc2-core-foundation
only.pub unsafe fn appendBezierPathWithArcFromPoint_toPoint_radius( &self, point1: NSPoint, point2: NSPoint, radius: CGFloat, )
objc2-core-foundation
only.pub unsafe fn appendBezierPathWithCGGlyph_inFont( &self, glyph: CGGlyph, font: &NSFont, )
NSFont
and crate feature objc2-core-graphics
and Apple only.pub unsafe fn appendBezierPathWithCGGlyphs_count_inFont( &self, glyphs: NonNull<CGGlyph>, count: NSInteger, font: &NSFont, )
NSFont
and crate feature objc2-core-graphics
and Apple only.pub unsafe fn appendBezierPathWithRoundedRect_xRadius_yRadius( &self, rect: NSRect, x_radius: CGFloat, y_radius: CGFloat, )
objc2-core-foundation
only.pub unsafe fn containsPoint(&self, point: NSPoint) -> bool
Source§impl NSBezierPath
Methods declared on superclass NSObject
.
impl NSBezierPath
Methods declared on superclass NSObject
.
Source§impl NSBezierPath
NSBezierPathDeprecated.
impl NSBezierPath
NSBezierPathDeprecated.
pub unsafe fn cachesBezierPath(&self) -> bool
pub unsafe fn setCachesBezierPath(&self, flag: bool)
pub unsafe fn appendBezierPathWithGlyph_inFont( &self, glyph: NSGlyph, font: &NSFont, )
NSFont
only.pub unsafe fn appendBezierPathWithGlyphs_count_inFont( &self, glyphs: NonNull<NSGlyph>, count: NSInteger, font: &NSFont, )
NSFont
only.pub unsafe fn appendBezierPathWithPackedGlyphs( &self, packed_glyphs: NonNull<c_char>, )
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
Available on crate feature NSAccessibilityConstants
only.
pub fn class(&self) -> &'static AnyClass
NSAccessibilityConstants
only.Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init
/new
methods).
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.Available on crate feature NSAccessibilityConstants
only.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.NSAccessibilityConstants
only.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Available on crate feature NSAccessibilityConstants
only.
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
NSAccessibilityConstants
only.Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl AsRef<AnyObject> for NSBezierPath
impl AsRef<AnyObject> for NSBezierPath
Source§impl AsRef<NSBezierPath> for NSBezierPath
impl AsRef<NSBezierPath> for NSBezierPath
Source§impl AsRef<NSObject> for NSBezierPath
impl AsRef<NSObject> for NSBezierPath
Source§impl Borrow<AnyObject> for NSBezierPath
impl Borrow<AnyObject> for NSBezierPath
Source§impl Borrow<NSObject> for NSBezierPath
impl Borrow<NSObject> for NSBezierPath
Source§impl ClassType for NSBezierPath
impl ClassType for NSBezierPath
Source§const NAME: &'static str = "NSBezierPath"
const NAME: &'static str = "NSBezierPath"
Source§type ThreadKind = <<NSBezierPath as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<NSBezierPath as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for NSBezierPath
impl CopyingHelper for NSBezierPath
Source§type Result = NSBezierPath
type Result = NSBezierPath
Self
if the type has no
immutable counterpart. Read moreSource§impl Debug for NSBezierPath
impl Debug for NSBezierPath
Source§impl Deref for NSBezierPath
impl Deref for NSBezierPath
Source§impl Hash for NSBezierPath
impl Hash for NSBezierPath
Source§impl Message for NSBezierPath
impl Message for NSBezierPath
Source§impl NSCoding for NSBezierPath
impl NSCoding for NSBezierPath
Source§impl NSCopying for NSBezierPath
impl NSCopying for NSBezierPath
Source§impl NSObjectProtocol for NSBezierPath
impl NSObjectProtocol for NSBezierPath
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref