DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | List of all members
NSBezierPath(DKEditing) Category Reference

This category provides some basic methods for supporting interactive editing of a NSBezierPath object. More...

Instance Methods

(NSSet *) - allBoundingBoxes
 
(NSBezierPath *) - bezierPathByRemovingElementAtIndex:
 
(NSBezierPath *) - bezierPathByRemovingTrailingElements:
 
(NSBezierPath *) - bezierPathByStrippingRedundantElements
 
(NSSet *) - boundingBoxesForPartcode:
 
(NSRect- boundingBoxForElement:
 
(NSUInteger- checksum
 
(NSPoint) - controlPointForPartcode:
 
(NSBezierPath *) - deleteControlPointForPartcode:
 
(void) - drawElementsBoundingBoxes
 
(NSInteger- elementBoundsContainsPoint:tolerance:
 
(NSInteger- elementHitByPoint:tolerance:tValue:
 
(NSInteger- elementHitByPoint:tolerance:tValue:nearestPoint:
 
(NSBezierPathElement) - elementTypeForPartcode:
 
(void) - getPathMoveToCount:lineToCount:curveToCount:closePathCount:
 Counts the number of elements of each type in the path. More...
 
(NSBezierPath *) - insertControlPointAtPoint:tolerance:type:
 
(BOOL- isOnPathPartcode:
 
(BOOL- isPathClosed
 
(void) - moveControlPointPartcode:toPoint:colinear:coradial:constrainAngle:
 
(NSPoint) - nearestPointToPoint:tolerance:
 
(NSInteger- partcodeForLastPoint
 
(NSInteger- partcodeHitByPoint:tolerance:
 
(NSInteger- partcodeHitByPoint:tolerance:prioritiseOnPathPoints:
 
(NSInteger- partcodeHitByPoint:tolerance:startingFromElement:
 
(NSInteger- partcodeHitByPoint:tolerance:startingFromElement:prioritiseOnPathPoints:
 
(NSPoint) - referencePointForConstrainedPartcode:
 
(void) - setControlPoint:forPartcode:
 
(BOOL- subpathContainingElementIsClosed:
 
(NSInteger- subpathEndingElementForElement:
 
(NSInteger- subpathStartingElementForElement:
 
(CGFloat- tangentAtEndOfSubpath:
 
(CGFloat- tangentAtStartOfSubpath:
 

Class Methods

(void) + colineariseVertex:cpA:cpB:
 
(NSPoint) + colinearPointForPoint:centrePoint:
 
(NSPoint) + colinearPointForPoint:centrePoint:radius:
 
(NSInteger+ point:inNSPointArray:count:tolerance:
 
(NSInteger+ point:inNSPointArray:count:tolerance:reverse:
 
(void) + setConstraintAngle:
 

Detailed Description

This category provides some basic methods for supporting interactive editing of a NSBezierPath object.

Author
Contributions from the community; see CONTRIBUTORS.md
Date
2005-2015

This category provides some basic methods for supporting interactive editing of a NSBezierPath object. This can be more tricky than it looks because control points are often not edited in isolation - they often crosslink to other control points (such as when two curveto segments are joined and a colinear handle is needed).

These methods allow you to refer to any individual control point in the object using a unique partcode. These methods will hit detect all control points, giving the partcode, and then get and set that point.

The moveControlPointPartcode:toPoint:colinear: is a high-level call that will handle most editing tasks in a simple to use way. It optionally maintains colinearity across curve joins, and knows how to maintain closed loops properly.

Method Documentation

- (NSSet*) allBoundingBoxes
- (NSBezierPath*) bezierPathByRemovingElementAtIndex: (NSInteger indx
- (NSBezierPath*) bezierPathByRemovingTrailingElements: (NSInteger numToRemove
- (NSBezierPath*) bezierPathByStrippingRedundantElements
- (NSSet*) boundingBoxesForPartcode: (NSInteger pc
- (NSRect) boundingBoxForElement: (NSInteger elementIndex
- (NSUInteger) checksum
+ (void) colineariseVertex: (NSPoint)  inPoints[3]
cpA: (NSPoint *)  outCPA
cpB: (NSPoint *)  outCPB 
+ (NSPoint) colinearPointForPoint: (NSPoint)  p
centrePoint: (NSPoint)  q 
+ (NSPoint) colinearPointForPoint: (NSPoint)  p
centrePoint: (NSPoint)  q
radius: (CGFloat r 
- (NSPoint) controlPointForPartcode: (NSInteger pc
- (NSBezierPath*) deleteControlPointForPartcode: (NSInteger pc
- (void) drawElementsBoundingBoxes
- (NSInteger) elementBoundsContainsPoint: (NSPoint)  p
tolerance: (CGFloat tol 
- (NSInteger) elementHitByPoint: (NSPoint)  p
tolerance: (CGFloat tol
tValue: (CGFloat *)  t 
- (NSInteger) elementHitByPoint: (NSPoint)  p
tolerance: (CGFloat tol
tValue: (CGFloat *)  t
nearestPoint: (NSPoint *)  npp 
- (NSBezierPathElement) elementTypeForPartcode: (NSInteger pc
- (void) getPathMoveToCount: (NSInteger *)  mtc
lineToCount: (NSInteger *)  ltc
curveToCount: (NSInteger *)  ctc
closePathCount: (NSInteger *)  cpc 

Counts the number of elements of each type in the path.

Pass NULL for any values you are not interested in

Parameters
mtc,ltc,ctc,cpcpointers to integers that receive the counts for each element type
- (NSBezierPath*) insertControlPointAtPoint: (NSPoint)  p
tolerance: (CGFloat tol
type: (NSInteger controlPointType 
- (BOOL) isOnPathPartcode: (NSInteger pc
- (BOOL) isPathClosed
- (void) moveControlPointPartcode: (NSInteger pc
toPoint: (NSPoint)  p
colinear: (BOOL colin
coradial: (BOOL corad
constrainAngle: (BOOL acon 
- (NSPoint) nearestPointToPoint: (NSPoint)  p
tolerance: (CGFloat tol 
- (NSInteger) partcodeForLastPoint
- (NSInteger) partcodeHitByPoint: (NSPoint)  p
tolerance: (CGFloat t 
- (NSInteger) partcodeHitByPoint: (NSPoint)  p
tolerance: (CGFloat t
prioritiseOnPathPoints: (BOOL onpPriority 
- (NSInteger) partcodeHitByPoint: (NSPoint)  p
tolerance: (CGFloat t
startingFromElement: (NSInteger startElement 
- (NSInteger) partcodeHitByPoint: (NSPoint)  p
tolerance: (CGFloat t
startingFromElement: (NSInteger startElement
prioritiseOnPathPoints: (BOOL onpPriority 
+ (NSInteger) point: (NSPoint)  p
inNSPointArray: (NSPoint *)  array
count: (NSInteger count
tolerance: (CGFloat t 
+ (NSInteger) point: (NSPoint)  p
inNSPointArray: (NSPoint *)  array
count: (NSInteger count
tolerance: (CGFloat t
reverse: (BOOL reverse 
- (NSPoint) referencePointForConstrainedPartcode: (NSInteger pc
+ (void) setConstraintAngle: (CGFloat radians
- (void) setControlPoint: (NSPoint)  p
forPartcode: (NSInteger pc 
- (BOOL) subpathContainingElementIsClosed: (NSInteger element
- (NSInteger) subpathEndingElementForElement: (NSInteger element
- (NSInteger) subpathStartingElementForElement: (NSInteger element
- (CGFloat) tangentAtEndOfSubpath: (NSInteger elementIndex
- (CGFloat) tangentAtStartOfSubpath: (NSInteger elementIndex