NSBezierPath techniques?
NSBezierPath techniques?
- Subject: NSBezierPath techniques?
- From: "James G. Pengra" <email@hidden>
- Date: Tue, 9 Apr 2002 17:18:51 -0700
I would like to draw a segmented path using mouse clicks to
designate points along the path. I would like to develop the path a
piece at a time by clicking at successive points in an NSView. (I'm a
refugee from the old Mac ways of drawing using the Quickdraw MoveTo
and LineTo commands.)
After instantiating NSBezierPath and setting the starting point, I
overrode the mouseDown method to get the next point on the path and
employed the method "+(void)strokeLineFromPoint:a toPoint:b" to draw
the next segment, but Project Builder told me that NSBezierPath does
not respond to that method, so my first question is - why not?
I also tried to simply add the mouse-click point to the BezierPath
and then re-stroke the whole path, even though that seems like
overkill. My second question is: is it necessary to stroke the whole
path just to display one more segment of the path on screen?
In the example code that I'm using as a guide, the BezierPath is
"stroked" from within the "- (void)drawRect:(NSRect)rect" method. In
my case I'm trying to draw from within a mouseDown method, so I
suspect that I'm not getting the NSView properly focused so that draw
commands can take effect, so my last question is: Can you make the
drawing commands work from anywhere withing your code, or must you
work through established methods like -(void)drawRect:rect?
Thanks for your patience, Jim
_______________________________________________
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.