[Drawkit] Drawkit Digest, Vol 9, Issue 4

Bill Monk billmonk at mac.com
Sat Nov 8 00:03:03 PST 2008


Graham,

Thanks! That really helped. All working beautifully now, and it was  
easy to create each shape with a default transparent fill and pre- 
select it before the window opens.

While testing with many of these these little polygon editors open, I  
noticed that the selected shape's outline color in each window cycles  
between cyan, magenta, and green (stroking is turned off). This is a  
nice feature; it subtly helps distinguish between multiple windows but  
isn't garish, the way totally random colors would look. I'm assuming  
of course that this -is- a feature, and not a semi-random bug I've  
introduced <g>

Thanks again,and BTW apologies for posting with a bad subject line -  
my bad for posting at 3AM...

-BIll

On Nov 7, 2008, at 3:02 PM, drawkit-request at lists.apptree.net wrote:
>
>
> Hi Bill,
>
> This should be straightforward. Essentially what you need to do is:
>
> a) create a drawable object from your points. If you want to be able
> to freely adjust the points, use DKDrawablePath. If you want to keep
> the shape the same and just scale it, rotate it, etc. as a unit, use
> DKDrawableShape.
>
> b) add the object to the drawing in a drawing layer (by default a
> suitable layer is created for you)
>
> c) let the user manipulate the object.
>
> d) as needed, extract the points you want.
>
> For parts a) and d), you can most easily use NSBezierPath - form a
> path from the points you have then use that to initialise the object.
> To get the points back, use [theObject renderingPath] to get the
> object's path and then you can get the points using the usual Cocoa
> methods. Methods of DKDrawing (which also inherits from DKLayerGroup)
> can be used to access the layer that contains the object, and of
> course it's probably easiest to retain a reference to it in your
> controller as well.
>
> Unless you subclass one of the standard drawable classes, you won't
> find existing properties such as 'topLeft' and so on. Instead each
> drawable maintains a path using NSBezierPath which stores the points
> in the standard way. Of course you could subclass to add these
> properties or add them using a category on one of the standard  
> objects.
>
> You don't need to set the polygon tool at any time. The tool is only
> used when creating new shapes/paths interactively. When manipulating
> the points of an existing shape, the select/edit tool is used and that
> is set by default.
>
>
> hth,
>
>
> Graham
>
>
> ------------------------------
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
>
>
> End of Drawkit Digest, Vol 9, Issue 4
> *************************************



More information about the Drawkit mailing list