• 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: Keith Blount <email@hidden>
  • Date: Thu, 31 Mar 2005 03:47:48 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

Many thanks for your reply, Bob, much appreciated.

> 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.

You are, of course, completely right - I made a silly
mistake and overlooked the obvious. Because I was
creating my curved bezier path from a series of rects,
I somehow had it in my head that I didn't need to
check the points were centered properly. As soon as I
went through every point and cast the x and y factors
to ints, then added on 0.5 to ensure they were all
centered on pixels, the stroked path came out crisp
and clear for the 1 pixel line exactly as I had
wanted. I should have tried that before posting,
sorry.

Many thanks again for the help,
Keith

--- Robert Clair <email@hidden> wrote:
> 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 You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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: handle kill of foundation tool
  • Next by Date: Re: Accessing NSArray objects with a key path
  • Previous by thread: Re: Insetting a complex NSBezierPath shape?
  • Next by thread: NSTableView and row selection
  • Index(es):
    • Date
    • Thread