• 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: Insetting a complex NSBezierPath shape?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insetting a complex NSBezierPath shape?


  • Subject: Re: Insetting a complex NSBezierPath shape?
  • From: Robert Clair <email@hidden>
  • Date: Thu, 31 Mar 2005 00:16:49 -0500

You can't do this exactly because, as had been noted many times, the offset of a Bezier curve isn't a Bezier curve. Therefore there is no NSBezierPath that is the exact inset of another NSBezierPath (unless the path contains only line segments).

A reasonable approximation ( for small offsets ) can be obtained by

1) making a polygon out of the Bezier curves control points

2) offsetting the polygon (requires some high school geometry)

3) using the vertices of the offset polygon as the control points for a new Bezier curve.

You have to be a bit careful if any of the polygon segments makes a very small acute angle with a neighbor - the offset vertex can go very far away.

That being said, it's unlikely that, if you do this with a one pixel offset, it will look much different or any better than just stroking the path.

....Bob Clair

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Mouse Input...
  • Next by Date: Re: adding NSView from other application
  • Previous by thread: Re: Insetting a complex NSBezierPath shape?
  • Next by thread: Re: Insetting a complex NSBezierPath shape?
  • Index(es):
    • Date
    • Thread