• 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: Caching NSBezierPath drawings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Caching NSBezierPath drawings (From: MT <email@hidden>)
 >Re: Caching NSBezierPath drawings (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Caching NSBezierPath drawings
  • Next by Date: Re: Nib - children problem.
  • Previous by thread: Re: Caching NSBezierPath drawings
  • Next by thread: [self release] question...
  • Index(es):
    • Date
    • Thread