• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSImage picks wrong representation for scaling?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage picks wrong representation for scaling?


  • Subject: NSImage picks wrong representation for scaling?
  • From: Christian Walther <email@hidden>
  • Date: Sun, 16 Apr 2006 10:31:14 +0200

I need to display file icons in arbitrary sizes in a custom NSView subclass. I'm doing this as follows:

[[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh];
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile: thePath];
[icon setSize: NSMakeSize(iconSize, iconSize)];
[icon compositeToPoint: NSMakePoint(...) operation: NSCompositeSourceOver];


What I observe is that, unless iconSize exactly matches the size of one of the icon representations (16, 32, 64, 128), a scaled down version of the *biggest* available representation is rendered. That means that I get a blurry icon with faint lines at 31 px, a sharp one with 1 px lines at 32, and again a blurry one at 33.

What I'd like to have is that the *next bigger* representation is selected for scaling down, so that at 31 px I get the 32x32 version scaled by 31/32, not the 128x128 version scaled by 31/128. Is there a way of achieving this, short of manually examining the available representations and picking the right one?

Actually I'd expect this behavior to be the default, if I'm interpreting <http://developer.apple.com/documentation/Cocoa/ Conceptual/CocoaDrawingGuide/Images/chapter_7_section_2.html#// apple_ref/doc/uid/TP40003290-CH208-BCIGEIFF> correctly. Is what I'm observing a bug? This is on 10.4.5, if that matters. I tried playing with [icon setMatchesOnMultipleResolution: NO], but as expected that didn't change anything.

 -Christian
_______________________________________________
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


  • Follow-Ups:
    • Re: NSImage picks wrong representation for scaling?
      • From: Christian Walther <email@hidden>
  • Prev by Date: applying a distortion filter
  • Next by Date: New windows and accepting input...
  • Previous by thread: applying a distortion filter
  • Next by thread: Re: NSImage picks wrong representation for scaling?
  • Index(es):
    • Date
    • Thread