Re: NSImage or NSBezierPath : what is the fastest ?
Re: NSImage or NSBezierPath : what is the fastest ?
- Subject: Re: NSImage or NSBezierPath : what is the fastest ?
- From: Ricky Sharp <email@hidden>
- Date: Wed, 3 Aug 2005 20:44:40 -0500
On Aug 3, 2005, at 11:12 AM, Eric Morand wrote:
I want to design my own control (button-like) and am wondering what
is the most efficient way to draw it on th screen : compositing
images (png format, created with photoshop) or using NSBezierPath ?
My control will use a flat design, so I can use NSImage or
NSBezierPath to draw it. My only concern is efficiency.
In all my custom controls, I cache an NSImage (or images) which
represent various states. Each control maintains a flag
(needsCreateImages) which is initially set false. It is also set
false in all setter methods which change visible attributes (e.g.
strings, colors, base images). In my drawRect,
drawInteriorWithFrame, etc. I call a createImages method if the flag
is set true. Otherwise the draw is a simple "blit" of the cached image.
For my custom focus rings, I cache NSBezierPath objects.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden