On 25.08.2012, at 18:05, Andy Lee <[email protected]> wrote:
> hard to speculate since I don't know what this method is used for.

 It's for resolution independence and sharp line drawing.

Quartz coordinates run *between* pixels, so if you draw a 1px black line from 
10,10 to 100,10, you get a 2-pixel-wide 50% grey line (because each pixel 
should be half white and half black, but since one can't do half pixels, it 
just averages the two values).

To fix this, before resolution independence, you just added 0.5 to the 
coordinate, which made it run through the middle of each pixel. But with 
resolution independence, you could (theoretically, if not yet in practice) have 
a 3x scale factor, in which case adding 0.5 would actually cause inaccurate 
drawing even though you could just draw that middle line.

So they added this call, which you feed resolution-independent point 
coordinates and it nudges them depending on how many pixels your current 
context uses per point, to give you a sharp line (at the loss of a bit of 
precision, but only a little, and only when actually needed).

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.com




_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to