Re: Quickly swapping NSImages / NSImageReps
Re: Quickly swapping NSImages / NSImageReps
- Subject: Re: Quickly swapping NSImages / NSImageReps
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 17 Sep 2001 10:15:50 -0700
On Monday, September 17, 2001, at 09:55 AM, Ken Tabb wrote:
I'm after some advice. Is the better (i.e. fastest, not worried about
RAM
very much) way to:
[1] Keep swapping the image which is displayed in the NSImageView (i.e.
[myImageView setImage:theOtherNSImage];) as currently, or
[2] Have only 1x NSImage, with 2x separate NSBitmapImageReps (as
before),
and keep adding and removing representations from the NSImage. I'd never
need to call [myImageView setImage] then, as it'd be the same image
(just
with different reps). Presumably this way I'd need to make sure the
NSImage isn't caching its reps, otherwise it'll have the wrong
NSBitmapImageRep being cached? Is there anything I've got to call (at
either the NSImage or NSImageView level) to get the different bitmap to
'take effect' onscreen? I'm imagining I've got to call [myImageView
setNeedsDisplay:YES], but don't know if that's all?
I don't think you'll gain any speed by switching to option two, but you
would increase the complexity. Changing the NSImage of the NSImageView
is nothing more than setting a pointer and redrawing.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.