Re: NSImageView setImageScaling:NSScaleToFit blurs image
Re: NSImageView setImageScaling:NSScaleToFit blurs image
- Subject: Re: NSImageView setImageScaling:NSScaleToFit blurs image
- From: "R.L. Grigg" <email@hidden>
- Date: Tue, 4 Mar 2008 13:44:30 -0800
Mike, Jens,
I created a NSImageView subclass and call [[NSGraphicsContext
currentContext] setImageInterpolation:NSImageInterpolationNone] in
the overridden -drawRect: method just before invoking [super
drawRect:aRect]. It works perfectly!!! I get a clean scaled-up image
with no blurring!
Thanks, I learned a lot!
Russ
On Mar 4, 2008, at 12:59 PM, Jens Alfke wrote:
On 4 Mar '08, at 12:02 PM, R.L. Grigg wrote:
Mike, yes that is something we tried but it seems to have no
effect on the blurring.
You have to set the interpolation at the moment the image is being
drawn, i.e. just before the NSImage draw/composite call. You can't
do this using a regular NSImageView; it draws the image for you and
has no ability to configure the interpolation.
You can either make a custom NSView and do the drawing in its -
drawRect: method; or you can create a scaled-up NSImage, draw the
small NSImage into it using the appropriate interpolation, and then
put the scaled-up NSImage into the NSImageView.
—Jens
On Mar 4, 2008, at 11:52 AM, Mike Abdullah wrote:
When you draw the image, have you tried doing [[NSGraphicsContext
currentContext] setImageInterpolation: NSImageInterpolationNone] ?
Mike.
_______________________________________________
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