• 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: Round Rect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Round Rect


  • Subject: Re: Round Rect
  • From: Greg Herlihy <email@hidden>
  • Date: Wed, 29 Mar 2006 22:06:36 -0800
  • Thread-topic: Round Rect

Round corners are elliptical - because a circle is an ellipse (just as a
square is a rectangle). So technically, yes, the corners of a QuickDraw
RoundRect were drawn with ellipses - but those ellipsis were always circles.
And in fact the sample code posted shows as much since it calls
appendBezierPathWithArcWithCenter - a method whose curves are always
circular.

At any rate, here is a link to Apple's Core Graphics recipe for drawing
round rectangles. Most of the CG routines have Cocoa analogs, so it would be
pretty straightforward to adapt this code for Cocoa:

http://developer.apple.com/documentation/Carbon/Conceptual/QuickDrawToQuartz
2D/tq_other/chapter_3_section_6.html#//apple_ref/doc/uid/TP40001098-CH220-Do
ntLinkElementID_18

Greg


On 3/29/06 7:17 PM, "Henry McGilton" <email@hidden> wrote:

>
>
> On Mar 29, 2006, at 5:51 PM, Gregory Weston wrote:
>
>> John C. Randolph wrote:
>>
>>> On Mar 29, 2006, at 6:00 AM, Valerio Ferrucci wrote:
>>>
>>>> how can I draw a round rect in cocoa?
>>>
>>>  From the list archives:
>>>
>>> http://lists.apple.com/archives/Cocoa-dev/2001/Aug/msg01710.html
>>
>> The traditional Mac OS RoundRect has elliptical corners,
>> though, rather than circular. Here's the implementation I use.
>
> Well, I was following this thread in a desultory fashion until
> your statement about traditional RoundRect has elliptical corners
> caught my eye.
>
> (1)  Is that true even for 'rectangles' that are actually square?
>
> (2)  Do the x and y radii of the ellipse vary with the width and
>       height of the rectangle?
>
> If the answers to (1) and (2) are affirmative, perhaps another
> approach is to draw a unit path and scale it with an
> appropriate affine transform . . .
>
>      Cheers,
>          ........  Henry
>
>
>
> ===============================+============================
>    Henry McGilton, Boulevardier |    Trilithon Software
>     Objective-C/Java Composer   |     Seroia Research
> -------------------------------+----------------------------
>    mailto:email@hidden   |   http://www.trilithon.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


 _______________________________________________
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

References: 
 >Re: Round Rect (From: Henry McGilton <email@hidden>)

  • Prev by Date: NSImage Path
  • Next by Date: subview within NSView?
  • Previous by thread: Re: Round Rect
  • Next by thread: Re: Round Rect
  • Index(es):
    • Date
    • Thread