Skip navigation.
 
mlNSImage scaling and ugliness
FROM : Stephen F. Booth
DATE : Mon Jul 10 20:42:13 2006

I am working on a view that contains an NSTableView displaying a list 
of files.  I want to display the file's icon and the last component 
of the pathname.  Rather than implement a custom subclass of 
NSTextFieldCell or NSImageCell (like ImageAndTextCell), I chose to 
just use a table with two columns.  The first is 16 pixels wide for 
the icon and the second holds the filename.  Everything works 
properly, but some of the icons when scaled to 16x16 look terrible 
when compared to the similar view in Finder.  I've posted a 
screenshot of the two windows at http://img354.imageshack.us/
img354/3091/picture14fn.png

My code for grabbing the icon looks like:

NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:filename];
[icon setSize:NSMakeSize(16, 16)];

I have tried setting the scalesWhenResized property, with identical 
results.  The icons that aren't pretty are mainly ones that have no 
16x16 representation, but since Finder can display them I assume 
there is something I'm not doing.

Does one have to use CoreGraphics to get good scaling?

Related mailsAuthorDate
mlNSImage scaling and ugliness Stephen F. Booth Jul 10, 20:42
mlRe: NSImage scaling and ugliness Christian Walther Jul 10, 22:05
mlRe: NSImage scaling and ugliness Matt Neuburg Jul 12, 05:11
mlRe: NSImage scaling and ugliness Matt Neuburg Jul 13, 21:55
mlRe: NSImage scaling and ugliness Matt Neuburg Jul 14, 22:57