• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Core Data for managing subtree?
  • Next by Date: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Previous by thread: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Next by thread: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Index(es):
    • Date
    • Thread