• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Writing a freehand paint tool [Solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Freelance programming
  • Next by Date: Re: Detecting login/logout?
  • Previous by thread: Re: Freelance programming
  • Next by thread: Objective-C default arguments??
  • Index(es):
    • Date
    • Thread