• 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: Why CGPathAddCurveToPoint returns to the origin?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why CGPathAddCurveToPoint returns to the origin?


  • Subject: Re: Why CGPathAddCurveToPoint returns to the origin?
  • From: Gustavo Pizano <email@hidden>
  • Date: Fri, 5 Mar 2010 19:07:05 +0100

Hello Duncan.

I want to draw the inside of a UIButton with a gradient,  so I just place in IB a Cusotm Buttom, and in the drawRect I taking its bounds, and from there Im getting the midX,minX etc.
So let me see if I get this straight, and rechecking the docs,.

OHHHHH OMG!!
I m such an idiot, I was using the wrong method, I needed the CGContextAddArcToPoint,...

my mistake... sorry

Thx

Gustavo


On Mar 5, 2010, at 6:46 PM, David Duncan wrote:

> On Mar 5, 2010, at 5:45 AM, Gustavo Pizano wrote:
>
>> EHH nop sorry, I fixed and still I get the nice flower..
>> 	CGContextBeginPath(currentContext);
>>
>> 	CGContextMoveToPoint(currentContext,midX,minY);
>> 	CGContextAddCurveToPoint(currentContext, maxX , minY, maxX, midY , 2.0f, 2.0f);
>> 	CGContextAddCurveToPoint(currentContext, maxX, maxY, midX, maxY, 2.0f, 2.0f);
>> 	CGContextAddCurveToPoint(currentContext,minX , maxY, minX, midY, 2.0f, 2.0f);
>> 	CGContextAddCurveToPoint(currentContext, minX, minY, midX,minY, 2.0f, 2.0f);
>>
>> 	CGContextClosePath(currentContext);
>>
>> 	CGContextClip(currentContext);
>> .....
>> Any ideas?
>
>
> First off, what are you trying to draw?
>
> The reason why you are getting a nice flower-ish pattern is because you are asking all of your curves to trace through 2 points and end at the same location (2,2). CGContextAddCurveToPoint generate a bezier curve that starts at the current location, approaches the 2 control points (which are your various combinations of min/mid/max x/y) and ends at the end point (which is always 2,2).
> --
> David Duncan
> Apple DTS Animation and Printing
>

_______________________________________________

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

  • Follow-Ups:
    • Re: Why CGPathAddCurveToPoint returns to the origin?
      • From: Henry McGilton <email@hidden>
References: 
 >Why CGPathAddCurveToPoint returns to the origin? (From: Gustavo Pizano <email@hidden>)
 >Re: Why CGPathAddCurveToPoint returns to the origin? (From: Gustavo Pizano <email@hidden>)
 >Re: Why CGPathAddCurveToPoint returns to the origin? (From: Gustavo Pizano <email@hidden>)
 >Re: Why CGPathAddCurveToPoint returns to the origin? (From: David Duncan <email@hidden>)

  • Prev by Date: Displaying two different sub-entities in one table view
  • Next by Date: Re: How a window was closed?
  • Previous by thread: Re: Why CGPathAddCurveToPoint returns to the origin?
  • Next by thread: Re: Why CGPathAddCurveToPoint returns to the origin?
  • Index(es):
    • Date
    • Thread