Re: Line Drawing problem
Re: Line Drawing problem
- Subject: Re: Line Drawing problem
- From: Dale Satterfield <email@hidden>
- Date: Sun, 03 Jul 2011 17:39:38 -0700
Thanks Jens,
I have tried that and it does not change the appearance. One thing I did do after trying that was to turn anti-aliasing off. That does make a difference. But does not solve all the problems.
I started with the code in XCode3 Unleashed in chapter 13 which plots points. On page 193 is the drawRect code. It makes the coordinate space the same as the extent of the data.
In my case I know that X always ranges between 0 and 11. In any case unitSize.height = 0.277778, unitSize.width = 0.013415 are the values it computes.
I put the code x += 0.5 * unitSize.width and y += 0.5 * unitSize.height in the code, but that did not make any noticeable difference
Hopefully this image will show in your email. Note that the horizontal lines though much thinner, at least now show up as black with the anti-aliasing turned off. I still have to have anti-aliasing on,
so I still have the problem, as well as the diagonal lines >> thicker than horizontal issue. Not sure how to fix that either, as there are no "brushes" that I can see discussed in the Cocoa drawing guide.
On Jul 3, 2011, at 2:51 PM, Jens Alfke wrote:
>
> On Jul 3, 2011, at 1:48 PM, Dale Satterfield wrote:
>
>> Lines with sufficient slope always draw in Black(the set color), and the specified width. However if the slope is low enough they print thinner, and in a different color.
>> This is an example:
>
> The image didn’t show up, but you’re probably seeing the effects of subpixel antialiasing, which uses the relative positions of the R, G and B subcomponents of an LCD pixel to increase apparent horizontal resolution.
>
> Another issue that’s probably exacerbating the distortion is that, if you’re drawing 1-pixel wide lines [or any odd integer width] you should offset their x and y coords by 0.5 to ensure that, if horizontal/vertical or nearly so, the lines end up entirely within a pixel instead of split between two pixels, which will smear them. (The reason for this is that the pixels are in between integer grid coordinates, so the pixel centers are at 0.5, 1.5, 2.5, etc.)
>
> —Jens
Dale Satterfield
email@hidden
_______________________________________________
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