Re: z in d attribute of path element

Dave,

> So when I convert such a relative path to absolute,
> Same logic applies? Search back (in the converted attribute) for last M|m
> z|z command and use those coords?

If I'm understanding your question correctly, then yes.  If you convert all
relative path coordinates to absolute coordinates (no more m or z, only M
and Z now), then work backwards until you find the first M or Z command.  If
you find an M, then that's your sub-path's start point.  If you find a Z,
then you need to find that Z's sub-path's start point and then use that.

> E.g I've converted a relative lot to
> M 6 , 9876C 20, 9883 56, 9890 110, 9891
> 164, 9893 208, 9881 217, 9877 231, 9866 227, 9814 272, 9783
> 317, 9752 350, 9729 362, 9689 373, 9650 326, 9623 303, 9638
> 279, 9653 270, 9664 261, 9675 261, 9675 275, 9609 261, 9610
> 241, 9612 173, 9618 103, 9618 34, 9618 -11, 9614 -35, 9611
> -52, 9622 -36, 9706 -23, 9772 -3, 9865 -13, 9869 6, 9876
>
> and want to convert a z to absolute,
> my options are L 6,9876 which appears to match your above
> criteria.

The M6,9876 would be the matching command.  Absolute closepath and relative
closepath are the same path command, so you don't need to treat them
differently.

> Then if I have a later z
> it will still 'go home' to the same point, since the later z
> reflects the first M coords?

Yes, if you have something like "M .... z .... z" with no M's or z's other
than the ones shown, then the second closepath's start point will be the
same as the first closepath's start point.

You might want to look at:

    http://www.kevlindev.com/gui/path/index.htm

The path commands are a little bit down that page.  Follow the
getLastPoint() method in RelativeClosePath.js to see one way of implementing
this.

Kevin
KevLinDev - http://www.kevlindev.com

Received on Thursday, 11 April 2002 11:43:08 UTC