Re: Drawing on integral values? WAS proper boarder.
Re: Drawing on integral values? WAS proper boarder.
- Subject: Re: Drawing on integral values? WAS proper boarder.
- From: Scott Thompson <email@hidden>
- Date: Tue, 12 Apr 2005 14:35:05 -0500
On Apr 12, 2005, at 1:55 PM, John Brownlow wrote:
This is to do with either (a) not drawing on integral point values
or (b) drawing on integral point values.
Recently somebody said on this list that you should only draw on
integral values, like (1.0,1.0)... but elsewhere I have seen it
asserted that the pixels on the Mac screen fall in-between integral
values, so to draw a clean line you should use values like (0.5, 0.5).
The coordinate system on Mac OS X is set up (by default) so that a
point with integral coordinate values corresponds to the upper left
corner of the pixel on the display. If you draw a horizontal line
from that point, and the line has a stroke width of 1, then the
stroke will cover 1/2 pixel above the line and 1/2 pixel below the line.
The antialiasing of these 1/2 pixels leads to a line that is slightly
gray.
If you want to draw a solid line, you need to offset your stroke so
that the entire width of the stroke is inside the pixel boundaries.
One way to do that is to offset the stroke yourself by 1/2 point,
another way is to just translate the origin by 1/2 point.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden