• 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: 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.


  • Follow-Ups:
    • Re: Caching NSBezierPath drawings
      • From: MT <email@hidden>
References: 
 >Caching NSBezierPath drawings (From: MT <email@hidden>)

  • Prev by Date: Re: Cannot get indexOfObject to work
  • Next by Date: Re: Caching NSBezierPath drawings
  • Previous by thread: Caching NSBezierPath drawings
  • Next by thread: Re: Caching NSBezierPath drawings
  • Index(es):
    • Date
    • Thread