• 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: Wedgies anyone?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wedgies anyone?


  • Subject: Re: Wedgies anyone?
  • From: Kyle Hammond <email@hidden>
  • Date: Mon, 17 Jun 2002 14:46:08 -0500

Hi,

You're making it too hard. Cocoa makes it very simple to do what you want.

Here's my code for drawing some fraction of a pie. In the code below, maximum is the maximum value contained in the pie and value is the portion (out of maximum) that you'd like to fill in. You can stroke or fill the path, or use it as a clipping path for an image. I usually have startAngle = 0, but you can easily change that.

tempPath = [ NSBezierPath bezierPath ];
[ tempPath appendBezierPathWithArcWithCenter:centerPoint radius:radius
startAngle:startAngle
endAngle:( ( value / maximum ) * 360.0 ) + startAngle ];
[ tempPath lineToPoint:centerPoint ];
[ tempPath closePath ];

Best of luck,
Kyle
---------------------
Kyle Hammond
email@hidden

http://www.CodeBlazer.com/ - multimedia software solutions
http://www.isd.net/dsl03002/ - my personal home page
http://cocoabudget.home.att.net/ - Budget for MacOS X home page
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Wedgies anyone?
      • From: Robert Miller <email@hidden>
  • Prev by Date: Re: Webdings et.al. ?
  • Next by Date: Re: Webdings et.al. ?
  • Previous by thread: Re: Webdings et.al. ?
  • Next by thread: Re: Wedgies anyone?
  • Index(es):
    • Date
    • Thread