Skip navigation.
 
mlRe: Can NSImageView not antialias a bitmap image?
FROM : Nicko van Someren
DATE : Mon Oct 04 18:40:51 2004

On 4 Oct 2004, at 17:16, Glen Simmons wrote:

> I'm creating an NSImage from some 1 bit bitmap data using
> -[NSBitmapImageRep initWithBitmapDataPlanes:pixelsWide: ...] method. I
> then call setScalesWhenResized:YES b/c the NSImageView it's going to
> is larger than the original. I then set it in my NSImageView with
> setImage:. Nothing special. The problem is that the image looks fuzzy
> b/c the NSImageView is antialiasing it for me. How nice, except that's
> not what I want. And there's not a way to tell NSImageView not to
> antialias as far as I can see. What am I missing?


I'm not sure that there is a particular way to switch this off in
NSImageView but subclassing the image view with the following drawing
method works:

- (void)drawRect:(NSRect)rect {
   [NSGraphicsContext saveGraphicsState];
   [[NSGraphicsContext currentContext] setImageInterpolation:
NSImageInterpolationNone];
   [super drawRect: rect];
   [NSGraphicsContext restoreGraphicsState];    
}

Nicko

Related mailsAuthorDate
mlCan NSImageView not antialias a bitmap image? Glen Simmons Oct 4, 18:16
mlRe: Can NSImageView not antialias a bitmap image? Nicko van Someren Oct 4, 18:40
mlRe: Can NSImageView not antialias a bitmap image? Nicko van Someren Oct 4, 18:49
mlRe: Can NSImageView not antialias a bitmap image? Glen Simmons Oct 4, 19:32
mlRe: Can NSImageView not antialias a bitmap image? Nicko van Someren Oct 4, 20:07