Re: NSImage: caching a preview?
Re: NSImage: caching a preview?
- Subject: Re: NSImage: caching a preview?
- From: email@hidden
- Date: Mon, 4 Mar 2002 09:23:32 -0500
From: Howard J. Fink
>
Date: Sun, 3 Mar 2002 17:50:40 -0500
>
To: email@hidden
>
From: Rich Long <email@hidden>
>
Subject: NSImage: caching a preview?
>
>
Hi-
>
>
I've read over NSImage, NSImageRep, etc., and am still a bit
>
confused. I'd like to maintain a list of picture files, and for each
>
store a small preview (say 64 x 64 pixels). I don't want or need to
>
keep the original picture data in memory.
>
>
Any sample code out there?
>
>
Thanks,
>
Rich
The trick is the size when you give it focus. Try this:
NSImage *myImage; // = load the way you want
NSSize *mySmallSize; // = calculate the way you want
[myImage setScalesWhenResized:YES];
[myImage setSize: mySmallSize];
[myImage lockFocus];
[myImage unlockFocus];
Howard Fink
Eastman Kodak Company
_______________________________________________
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.