Higher-quality scaling of NSImages?
Higher-quality scaling of NSImages?
- Subject: Higher-quality scaling of NSImages?
- From: Eric Smith <email@hidden>
- Date: Sat, 1 Sep 2001 17:38:55 -0400
Greetings,
More newbie questions, I'm afraid. I'm rewriting an existing
Java/AWT application as an exercise for learning Cocoa. The
user-interface is coming along nicely, and working in Objective-C has
proven to be quite painless. Far and away, the biggest obstacle has
turned out to be the lack of adequate documentation.
The immediate problem I have is that my program displays large
scanned images which have to be scaled down (by a factor of about 3)
to fit on the screen. I'm displaying them in NSImageCells within an
NSMatrix, using NSImage setScalesWhenResized:YES. Unfortunately the
scaled-down result seems to be produced by simply sampling the
pixels, making the scaled-down image unreadable. In Java, I was able
to specify that scaling use an area-averaging filter, which was
sluggish but produced a very nice scaled image.
Is there any Cocoa way to tell the NSImage to prefer quality over
speed when scaling the image? There are a number of
resolution-related methods in NSImage, but none of them achieved the
desired effect. I did a quick search of the list archive, and the
closest I came was a rather discouraging thread entitled "NSImage in
NSTableView looks like poop". Do I have to use something else like
Quartz or GraphicKit in order to get better scaling? Any suggestions
would be welcome.
Thanks,
Eric Smith
Tarkvara Design Inc.