nosedive25
nosedive25

Reputation: 2435

Blurry NSImageView

I have an NSImageView in a view that utilizes Core Animation. Prior to using Core Animation the image looks fine but now its blurry and low quality. If I let NSImageView have a bezel border the issue goes away but I need it to have no border. Had this happened to anyone else?

Blurry image

Imgae in the background with no border, same image in the front with a border.

Thanks

EDIT: I forgot to mention that the image is an icon file (ICNS) so it has various sizes. The bordered view loads the correct size and the transparent one loads the smallest and stretches it.

Upvotes: 0

Views: 1146

Answers (2)

nosedive25
nosedive25

Reputation: 2435

Although not the way I wanted to, I managed to create a fix for the issue. The issue seemed to be the way that NSImageView was drawing the image so I created a custom NSView subclass with support for the same bindings I used in my original image view. Im not sure why the blurry-ness happend in the beginning, but drawing the image by hand in an NSView seems to do the trick.

Upvotes: 1

Francis McGrew
Francis McGrew

Reputation: 7272

Your image may be drawing in a non-pixel-aligned way. Have you tried shifting it by a half pixel?

Apple has a good demonstration of this in the BlurryView app in their "Cocoa Tips and Tricks" sample code.

Cocoa Tips and Tricks

Upvotes: 0

Related Questions