Re: help with bezpath please...
Re: help with bezpath please...
- Subject: Re: help with bezpath please...
- From: Frank Midgley <email@hidden>
- Date: Mon, 17 Oct 2005 15:01:46 -0500
On Oct 17, 2005, at 1:58PM, Brian O'Brien wrote:
does anyone know how to render a bezier path and have the control
points drawn for me?
Do you just want the control points drawn or do you want them to be
controls that the user can move around?
For just drawing you could do something like the following after
calling -stroke on the path:
Enumerate through the path's elements using -
elementAtIndex:associatedPoints: after getting the -elementCount.
If the element is a "move to" then
draw a control handle at the point
If the element is a "line to" then
draw a control handle at the end of the line
If the element is a "curve to" then
draw a line from the curve start to control point 1
draw a line from the curve end to control point 2
draw a control handle at the end of the curve and at the
control points
I saw this done in the sketch example...
ie... A line has two control points (One at each end)
A Rectangle / Square has 8 control points 4 at the corners and one
on each side..
A rectangle/square is just four line segments so there are no control
points in the middle of each side on the bezier path. The pseudo-
code above would not draw these.
A Circle / Oval has 4 points on the bounding box and one at each
tangent...
Again, the actual control points for the bezier path will not be at
these places so the pseudo-code above will not get you what you want.
It sounds more like you want controls for the bounding box of the
path, not the elements of the path. If that's the case then you can
just get the bounding box of the path and draw the points manually
using NSMinX(), NSMidX(), NSMaxX(), etc. The trick will be that each
type of object (line, square, circle, other?) will have to react
differently to the change in bounding box size. Sketch.app is
definitely the place to look for this kind of code.
-Frank
------------------------------------
Frank M. Midgley
email@hidden
http://homepage.mac.com/knarf/
_______________________________________________
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