W3C home > Mailing lists > Public > www-svg@w3.org > January 2013

Re: fancy lines

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Sat, 5 Jan 2013 19:15:50 +0100
To: www-svg@w3.org, bzipitidoo@gmail.com
Message-Id: <201301051915.50924.Dr.O.Hoffmann@gmx.de>
Hello,

in previous discussions about implementations and underlying libraries
it turned out, that stroke-dasharray is only defined in SVG to be a pattern
along the stroke, but unfortunately it is not implemented as such a pattern,
just something like subpaths, what restricts the usability of stroke-dasharray
dramatically and increases the number or reasons for bugs and annoying
behaviour in viewers. And there are more problems with stroke-dasharray,
if one has corners and spikes in the path or more than one subpath.
Therefore in practice stroke-dasharray today is only for very basic use
cases, if one does not care about details.

On the other hand, if you apply a pattern defined by a pattern element
to a stroke, it works in the same way as for fill - therefore the pattern
is not warped along the pace of the stroke - if you assumed this - it has
the same alignment as for a filled area.
Example with pattern for fill and stroke:
http://upload.wikimedia.org/wikibooks/de/1/13/SVGpattern01.svg


If you need only a fragment of the stroke perpendicular to the pace
of the stroke, you can get arbitrary fragments using clipping and masking,
using the same path data (or the inverse path data, switching
inside/outside) with different stroke-width as mask or clip-path.


Maybe in the future, new marker features from the SVG2 draft 
may provide more useful methods to get some pattern along the
stroke:
http://www.w3.org/TR/SVG2/painting.html#RepeatingMarkers




Olaf
Received on Saturday, 5 January 2013 18:16:19 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:53 GMT