On 16-Apr-2011, at 12:17 PM, Quincey Morris wrote:

> On Apr 15, 2011, at 20:55, Roland King wrote:
> 
>> I have a CGPath which represents a small (but somewhat complicated) shape 
>> and I want to append a number of them together, connected with straight 
>> lines, to form a complete closed shape which I then want to use as a clip 
>> region. I thought that CGPathAddPath would do what I wanted as I can easily 
>> give it an affine transform matrix to move and rotate the template path and 
>> add it several times, however if I understand the documentation correctly, 
>> that adds the path as a new subpath, not connecting it up. As I want to use 
>> the final path as a clip region that's not going to work, I need one 
>> continuous path. 
> 
> That's not how I'd interpret the documentation. The description of (say) 
> 'CGPathAddCurveToPoint' says: "Appends a cubic Bézier curve to a mutable 
> graphics path". The description of 'CGPathAddPath' says: "Appends a path to 
> onto a mutable graphics path". That suggest they have the same semantics.
> 
> For this to work, of course, both paths would need to be open.
> 
> Are you seeing different behavior when you try it?
> 
> It's possible you may need to do a 'CGMoveToPoint' specifying the last point 
> of the first piece before appending the second piece, but it's also possible 
> that this will create an unwanted 0-length line segment, so you should test 
> out the behavior.
> 
> 

Yeah I tried it, doesn't seem to work. The end of the documentation for 
CGPathAddPath says this " After the call completes, the start point and current 
point of the path are those of the last subpath in path2.". The fact it says 
'start' and 'end' means to me that it's started a new subpath and that's what 
it seems to me to be doing. I agree CGPathAddCurveToPoint and CGPathAddArc do 
draw a line to the point first, so the names are similar, but the semantics 
appear not to be. 

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to