Re: Caching NSBezierPath drawings
Re: Caching NSBezierPath drawings
- Subject: Re: Caching NSBezierPath drawings
- From: Shawn Erickson <email@hidden>
- Date: Fri, 19 Mar 2004 13:36:22 -0800
On Mar 19, 2004, at 9:28 AM, MT wrote:
Hi,
In my program I have many NSViews that draw quite complex things with
NSBezierPaths, it's starting to slow down a bit, so I'd like to look
at caching the drawings as an NSImage (?). What's the best way to do
this, how would I draw to an NSImage? (or would I do something else?)
I would first profile things to see what is taking the most time
otherwise you are guessing at how best to improve things.
Not sure how you are creating your paths or the "hot" pathway in your
code but consider reusing them instead of creating them on demand. Also
consider enabling image caching by the path itself
(setCachesBezierPath:YES).
If you want to use a cached image do something like the following to
draw into an image.
pathImage = [[NSImage alloc] initWithSize:...];
[pathImage lockFocus];
... do your drawing ...
[pathImage unlockFocus];
-Shawn
_______________________________________________
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.