NSBezierPath currentPoint
NSBezierPath currentPoint
- Subject: NSBezierPath currentPoint
- From: Andersen Studley <email@hidden>
- Date: Sun, 1 Feb 2004 19:48:03 -0800
Hello List,
I'm attempting to do some drawings with NSBezierPath, and while I can
get them to work, what I have to do just doesn't *feel* right.
FWIW - the archives have been invaluable to me thus-far, so please
don't think I haven't scoured them about this.
The two (four) methods I am using are relativeLineToPoint: and
relativeCurveToPoint: I have also tried lineToPoint: and
curveToPoint:, to no avail.
In short, I have to move the path to the current point before every
operation, as such
[path moveToPoint:[path currentPoint]];
The documentations states :
- (void)lineToPoint:(NSPoint)aPoint
Appends a straight line to the receivers path from the current point
to aPoint. The current point is the last point in the receivers most
recently added segment.
Which leads me to believe I could use them successively...
Here is what *doesn't* work - I get a line to where I want it, but then
it begins the arc at the point (0, radius)
[path moveToPoint:NSMakePoint(0, radius)];
[path relativeLineToPoint:NSMakePoint(deltaX , height - (radius * 2))];
[path relativeCurveToPoint:NSMakePoint(radius, radius)
controlPoint1:NSMakePoint(quarterRadius, quarterRadius)
controlPoint2:NSMakePoint(threeQuarterRadius, threeQuarterRadius)];
but if I add a moveToPoint it works as intended :
[path moveToPoint:NSMakePoint(0, radius)];
[path relativeLineToPoint:NSMakePoint(deltaX , height - (radius * 2))];
[path moveToPoint:[path currentPoint]]; //why do I need this???
[path relativeCurveToPoint:NSMakePoint(radius, radius)
controlPoint1:NSMakePoint(quarterRadius, quarterRadius)
controlPoint2:NSMakePoint(threeQuarterRadius, threeQuarterRadius)];
Of note is that what the docs state as far as currentPoint are
concerned.
- (NSPoint)currentPoint
Returns the receivers current point (the trailing point or ending
point in the most recently added segment). Raises NSGenericException if
the receiver is empty.
So, according to the docs, the first should work, but it doesn't. If
currentPoint is the ending point of the most recently added segment I
shouldn't need to move to it. Any thoughts? Am I reading the
documentation wrong? Am I crazy?
Thanks In Advance
Andersen Studley
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.