Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
- Subject: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
- From: Heinrich Giesen <email@hidden>
- Date: Thu, 17 Apr 2008 11:22:43 +0200
Graham Cox wrote:
Offsetting by 0.5 makes it draw such that the exact pixel is filled.
When a bezier path is more complicated it can become very ugly to add
0.5 to all coordinates.
To avoid this the NSBezierPath class offers the method -
transformUsingAffineTransform:
So you can create a bezier path "as usual" and before rendering
(stroke etc.) you
apply a tranformation:
NSBezierPath *bezierPath = [NSBezierPath bezierPath];
NSAffineTransform *transform = [NSAffineTransform transform];
// build the bezierPath
[transform translateXBy: 0.5 yBy: 0.5];
[bezierPath transformUsingAffineTransform: transform];
[bezierPath stroke];
And: if the bezier path shall always be drawn 1 pixel wide, independent
--
Heinrich Giesen
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