painting the dashes and gaps in a stroke-dasharray

Frequently, one wishes to determine the colors of both the gaps and the
dashes of a stroke.

 

Usually I have done this by drawing two (or more) copies of the path with
different strokes: http://srufaculty.sru.edu/david.dailey/svg/notknot.svg 

 

When the paths, though are huge (as in cartography) then repeatedly drawing
the path is not so efficient, performance-wise.

 

So in the use case where we have a boundary of a region that is stroked one
color on the French side and another color on the Belgian side and where
there may be a lake contained in France but sharing the border with Belgium,
we may wish to be able to adjust both colors of the dasharray as it has been
dually positioned on either side of a path segment shared by two superpaths.

 

One way to do this would be 

 

<path stroke="red" stroke-dasharray="8,18" stroke-gappaint="blue">

 

Another more expressive syntax would allow independent coloration of each
segment of the dash-array:

 

<path stroke="red" stroke-dasharray="8,18,8,18"
stroke-dashpaint="red,green,red,yellow" > in which paint server to each
segment of the path is author-controlled.

 

The latter might be very handy for mathematicians and jewelry makers (there
is a theory of beading and necklaces, that ties in rather nicely to the
theory of knots, as applied to weaving, fabric and textiles. BTW, I have run
into people in the textiles industry who are using SVG!). But, generally, I
am of the theory that more expressiveness is better, (particularly when it
is cheap, effort-wise), since the endless creativity of humans will usually
find something to do with the tools they are given.

 

 

Cheers

David

 

 

Received on Tuesday, 25 October 2011 15:50:01 UTC