Re: Forcing NSImageView's centered image not to be drawn on integral pixels?
Re: Forcing NSImageView's centered image not to be drawn on integral pixels?
- Subject: Re: Forcing NSImageView's centered image not to be drawn on integral pixels?
- From: Chris Ridd <email@hidden>
- Date: Tue, 10 Dec 2002 18:46:35 +0000
On 10/12/02 6:12 pm, Dan Wood <email@hidden> wrote:
>
I have an NSImageView with a bitmap NSImage aligned in the center.
>
This NSImageView grows along with its window, meaning that its size
>
changes horizontally and vertically, one pixel at a time.
>
>
The problem is that the NSImage, to remain perfectly centered,
>
straddles pixel boundaries much of the time. And this makes the image
>
look "blurry".
>
>
For a sense of what this does, take a look at my test image here:
>
<http://www.karelia.com/drop/testpat.jpg>
>
If the image view is an even number of pixels wide and high, then the
>
centered image looks just like that.
>
>
If the image view is an odd number of pixels wide, the image is drawn
>
at the half pixel, horizontally, and it looks like this:
>
<http://www.karelia.com/drop/blurry_h.jpg>. You see something similar
>
in the vertical direction. If both width and height are odd, it looks
>
even worse: <http://www.karelia.com/drop/blurry_h_and_v.jpg>
>
>
>
So I'm looking for ideas on preventing this from happening. I think
>
that I need to somehow constrain the NSImageView to only resize in
>
increments of two pixels so that it will always be an even number of
>
pixels wide and tall, so that the centered image will be drawn on
>
integral pixels. Or, somehow intercept the centering behavior of the
>
NSImageView so that pixels are aligned to their integral boundaries,
>
even if that means that they aren't perfectly centered.
>
>
Any suggestions?
Would adding a dummy blank line or column to the opposite side solve the
problem?
Cheers,
Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.