Re: NSImageView Will Not Alias Images
Re: NSImageView Will Not Alias Images
- Subject: Re: NSImageView Will Not Alias Images
- From: Chris Tracewell <email@hidden>
- Date: Tue, 6 Apr 2010 17:24:52 -0700
On Apr 6, 2010, at 4:50 PM, Ken Ferry wrote:
On Tue, Apr 6, 2010 at 2:58 PM, Jens Alfke <email@hidden> wrote:
On Apr 6, 2010, at 1:17 PM, Chris Tracewell wrote:
I am trying to get NSImageView to alias dropped images, but it
refuses.
Nitpick: you mean "antialias". Aliasing is what creates the jaggies,
antialiasing smooths them away.
Just spent an hour looking and trying several variations to no
avail. Here's what I have done in a subclass of NSImageView.
I remember having to deal with this too, years ago. It's too bad
AppKit hasn't added support for this yet :(
The problem is that NSImageView internally keeps a scaled copy of
the image. So the actual scaling that creates the aliasing isn't
done in the drawRect: method at all.
This was once true, but is out of date. I'd like to see a test
app. For example, how do you know you aren't getting antialiasing?
It may be that you just don't like the output. :-)
Well - NSImageInterpolationHigh and NSImageInterpolationNone produce
the same exact result - screen shot copy (control-command-shift-4) the
imageView built once using NSImageInterpolationHigh and once using
NSImageInterpolationNone then paste each into a Photoshop layer, align
them perfectly and then turn the top layer off and on at 800% and
there is not a single pixel that moves or changes color.
The dropped image is roughly 1000 x 1000 (a screen shot PNG) and the
imageView size is 200x200
To make sure the currentContext was correct - I log
[[NSGraphicsContext currentContext] imageInterpolation] for each build
and it shows the correct values 3 and 1 respectively. And then just to
be super sure I I log [[NSGraphicsContext currentContext]
isDrawingToScreen] inside drawRect of my NSImageView subclass and get
YES.
I did implement my own image sizing in drawRect and then used [self
setImage] and it works great. Not sure what could be the issue.
It would also be good to know what OS you are working on.
-Ken
I'm using 10.5.8. - XCode 3.1.2 - iMac Core 2 Duo and the app is GC.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden