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

Re: Clarification on SVG stroke implementation

From: Stephen Chenney <schenney@chromium.org>
Date: Tue, 22 Nov 2011 17:41:59 -0500
Message-ID: <CAObCcUox-V9yU-+mjfFH836oPc4BGkn82AW28_-Depnt753CDg@mail.gmail.com>
To: www-svg@w3.org
Thanks for the reply.

No problem on the linecaps issue.

I am confused by the marker discussion. I would expect "m 10 10 m 20 20" to
draw two markers, one at (10, 10) and one at (20, 20) because there are no
endpoints at all, just a lone point. And I expect "m 10 10 z m 20 20 z" to
draw four markers, because there are two lines of zero length, each with a
start- and end-point.

And now another question in the same vein. The Implementation
arcs says the following:
"If the endpoints (x1, y1) and (x2, y2) are identical, then this is
equivalent to omitting the elliptical arc segment entirely. ... Continuous
animations that cause parameters to pass through invalid values are not a
problem. The motion remains continuous."

This does not seem consistent to me. If you have an animated arc with
non-butt linecaps drawn, and the animation causes the endpoint of the arc
to match the start point, I would expect to see the equivalent of a
zero-length path. Under the current implementation note, for a frame (or
more) while the animation passes through zero length the linecaps will
flash out of existence. That's not continuous. I believe that a better
implementation note would be "If the endpoints (x1, y1) and (x2, y2) are
identical, then this is equivalent to a zero-length line (a lineto) from
one endpoint to the other."


On Mon, Nov 21, 2011 at 5:22 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Mon, Nov 21, 2011 at 1:08 PM, Stephen Chenney <schenney@chromium.org>
> wrote:
> > The SVG spec is ambiguous in two areas of path stroke specification and I
> > would like clarification in order to implement the correct behavior.
> > First: strokes and zero length lines. The spec is explicit.
> > http://www.w3.org/TR/SVG/painting.html#StrokeProperties
> >
> > A subpath (see Paths) consisting of a single moveto shall not be stroked.
> > Any zero length subpath shall not be stroked if
> > the ‘stroke-linecap’ property has a value of butt but shall be stroked if
> > the ‘stroke-linecap’ property has a value of round or square, producing
> > respectively a circle or a square centered at the given point. Examples
> of
> > zero length subpaths include 'M 10,10 L 10,10', 'M 20,20 h 0', 'M 30,30
> > z' and 'M 40,40 c 0,0 0,0 0,0'.
> >
> > Does the path 'M 10 10 M 20 20' define any stroked subpaths? I believe
> not,
> > as there is no "pen-down" drawing in the path. I believe the spec should
> > explicitly discuss this case.
> It does.  If you follow the reference to the chapter on paths, it
> states that every moveto operation starts a new subpath.  The example
> path you provide above, then, consists of two zero-length subpaths,
> and so nothing is stroked.
> > Second: Markers and the definition of "applicable vertex", as in
> > http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes
> >
> > If markers are specified, then a marker is drawn on every applicable
> vertex,
> > even if the given vertex is the end point of a zero-length path segment
> and
> > even if "moveto" commands follow each other.
> >
> > Specifically, should 'M 10 10' result in the drawing of a marker? Should
> 'M
> > 10 10 M 20 20' produce 2 markers? I believe so in both cases. A point
> > plotting application provides a use case, in which a natural way to draw
> the
> > points is to define a marker and any number of move-to, one for each
> point
> > to draw. Such code should work sensibly for just a single point.
> > The easiest way to resolve this would be for the spec to define
> "applicable
> > vertex" and provide examples as with the zero length path case.
> "applicable vertex" just refers to the starting, ending, or middle
> vertexes that markers can sit on.  It's not meant to actually be a new
> significant term.
> The spec specifically states in the section you quote that zero-length
> path segments still receive markers.  The first example path you
> provide will thus draw a start marker and an end marker, both at the
> same point, but no mid markers.  The second example path you provide
> will draw two starting markers and two ending markers, but again no
> mid markers.
> ~TJ
Received on Tuesday, 22 November 2011 22:42:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:33 UTC