Re: Writing a freehand paint tool [Solved]
Re: Writing a freehand paint tool [Solved]
- Subject: Re: Writing a freehand paint tool [Solved]
- From: "M. Uli Kusterer" <email@hidden>
- Date: Sat, 1 Nov 2003 03:33:31 +0100
At 20:57 Uhr +0100 31.10.2003, M. Uli Kusterer wrote:
I'm doing a sort of "brush" paint tool. Since this painting needs
to be composited onto another image, I subclassed an NSImageView,
and gave that mouseDown: mouseDragged: and mouseUp: methods that add
lines to my image using NSBezierPath.
Someone once told me it was a sign of age to find oneself replying
to oneself... oh well, I'm proud of what little age I have
accumulated so far ...
Problem solved.
Everythig could be summed up in one word: NSImageView. It wasn't
intended to do what I made it do, and by simply rewriting the whole
shebang to be a regular NSView subclass, it sped up considerably. It
might also have helped that instead of calling setImage:, which
redraws the entire view, I'm simply declaring the changed area of the
image dirty.
Another nifty trick I learned: It helps to do a
[image lockFocus];
[image unlockFocus];
on your empty NSImage immediately after creating it to make it behave
properly. Something about initializing its cache or something ;-)
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.