On 03.01.2010, at 00:45, Rob Keniger wrote:


It will probably be easier to create an NSAffineTransform and translate the whole context by 0.5px, so all drawing is offset without you needing to fiddle with individual values.

Just a hint:
NSBezierPath has a method which allows to use NSAffineTransform for this even outside a rendering/drawing process:

Description of transformUsingAffineTransform, a method of NSBezierPath:
Transforms all points in the receiver using the specified transform.

- (void)transformUsingAffineTransform:(NSAffineTransform *)aTransform

Example:

NSBezierPath *bPath = // create a path
// construct the complete path
NSAffineTransform *transform = [NSAffineTransform transform];
// move all coordinates to the center of the pixels
[transform translateXBy: 0.5 yBy: 0.5 ];
[bPath transformUsingAffineTransform:transform];
// bPath is now ready for drawing


--
Heinrich Giesen
gies...@acm.org


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to