Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CG vs QuickDraw



On 2007-06-10, at 11:33:16, Anders Markussen wrote:

Trying to draw a 1 point non-antialiased line. Filed a bug: -- "Works as expected". Sorry to be so forthright, but I think that's sub-standard.

What do you mean? What is it that doesn't work as you expect? All you need to remember are 2 rules:
CG like virtally all graphics systems use pixel boundaries for positioning, and CGContextStrokePath/CGContextStrokeRect centers the line on the path you specified.

So if you do CGContextMoveToPoint/CGContextAddLineToPoint with integer values, and have an odd line width it will of course look blurry, because you specified half the line to be drawn the pixels on either side of the path (which, as said, runs on the pixel boundary.

If you want the 1-pixel-wide line to not span several pixels, you simply add 0.5, so CGContextMoveToPoint(ctx, 10.5, 4); CGContextAddLineToPoint(ctx, 10.5, 24);

If it is diagonal lines you don't want antialiasing on, there is always CGContextSetShouldAntialias.

I know about the 1/2 pixel trick. It's a design bug that we have to do stuff like that in the first place.



Philip Aker email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >CG vs QuickDraw (From: Ingemar Ragnemalm <email@hidden>)
 >Re: CG vs QuickDraw (From: Philip Aker <email@hidden>)
 >Re: CG vs QuickDraw (From: "Anders Markussen" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.