Re: Caching NSBezierPath drawings
Re: Caching NSBezierPath drawings
- Subject: Re: Caching NSBezierPath drawings
- From: MT <email@hidden>
- Date: Fri, 19 Mar 2004 21:49:38 +0000
On 19 Mar 2004, at 21:36, Shawn Erickson wrote:
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];
That looks the type of thing I'm after, thanks.
It's definitely the drawing taking the time, actually it's mostly the
calculations that generate the NSBezierPaths.
Thanks again.
Moray
_______________________________________________
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.