scribbling
scribbling
- Subject: scribbling
- From: Richard Chamberlain <email@hidden>
- Date: Wed, 13 Aug 2003 12:45:19 +0100
Hello Folks,
I'm new to Cocoa so apologies if this is well covered or obvious.
I'm playing round with a custom view which you can scribble in - i.e.
drag the mouse around to draw.
My rather naive approach to this was to record the mouse down position
then in mouseDragged create a NSBezierPath between the two. After that
update the position and add the path to a NSMutableArray. I then called
setNeedsDisplay and in drawRect I go through the lines array and draw
them all.
Of course I realise that this has a fundamental flaw in that every call
to drawRect has to redraw everything and so it becomes noticeably
slower after a bit of furious scribbling.
I tried drawing in the mouseDragged method but that doesn't seem to
work.
After reading the docs the only way I can see of changing this is to
just make a portion of the view dirty and then run through the array
calculating whether that line is affected and if so redraw it.
This seems an all mighty pain, so is there something I've missed?
Thanks a lot,
Richard
_______________________________________________
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.