W3C home > Mailing lists > Public > www-svg@w3.org > November 2011

API for Retrieving Stroke Outline?

From: Mike Bostock <mbostock@cs.stanford.edu>
Date: Thu, 10 Nov 2011 08:39:16 -0800
Message-ID: <CAM36=qoMbjoSGx6uK=M+3TLWOGKyLboZg9roD74_EL7mVSGDWg@mail.gmail.com>
To: www-svg <www-svg@w3.org>
One feature I occasionally need with visualization is to create a
polyline with variable line width and stroke color. Since this can't
(currently) be done with a single polyline or path element, I
implemented miter joins in Protovis, allowing me to render each
segment of the polyline as a distinct path element:

  http://mbostock.github.com/protovis/ex/segmented.html

Another, more practical, example:

  http://en.wikipedia.org/wiki/File:Minard.png

I didn't implement all the other joins (or even miter limits), since
it's a lot of work. A new feature that could make this much easier,
and also potentially allow a lot of creative manipulation via
JavaScript, would be an interface for retrieving the vector outline of
a stroked path. In this example, I could create separate stroked paths
for each segment, pull out the coordinates and then create filled
paths.

We've already been discussing a text-to-path API [1]. How about a
stroke-to-path API?

Mike

[1] http://www.w3.org/Graphics/SVG/WG/wiki/Proposals/Text_to_path_API
Received on Thursday, 10 November 2011 16:40:14 GMT

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