W3C home > Mailing lists > Public > www-svg@w3.org > June 2010

Re: Why a stroke on top of a fill?

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Sat, 5 Jun 2010 13:03:19 +0200
To: www-svg@w3.org, bryan@brush.co.nz, juan@jvuletich.org, inkscape-devel@lists.sourceforge.net
Message-Id: <201006051303.20330.Dr.O.Hoffmann@gmx.de>
Hello,

just my individual interpretation, experiments and observations:

To stroke and to fill are two different methods to present a path.
Paths do not always have inside and outside, but can always be
stroked (even paths of zero lengths in SVG).

If you just assume, that an arbitrary path is stroked with a finite width, 
I think it is useful, that normally the stroke is centered on the path
and not somewhere else - this is the basic function of the path to
indicate exactly, where the stroke has to be.
If you need the presentation somewhere else, it might be the best
to change the path itself ;o)

To determine what is inside and outside is much more complex. 
But this is necessary to determine what to fill.
Surprising things may happen, especially if paths are
not closed or have a specific structure with no finite area, that can
be considered to be inside.
From this point of view it is much more surprising, that typically
viewers have a correct implementation of inside and outside and
filling ... 

However if you have a path with inside and outside, you can
use in the full version of SVG 1.1 clipping, masking and filters
and the (re)use of path data to select only an arbitrary fraction 
of the stroke to be presented without any number crunching
(I think, no author really wants to calculate the precise outline
of a stroke with large width of an elliptical arc or a cubic curve 
to get this manually right ;o)

With SVG tiny this is more limited, for example one can provide
the same path twice, first only stroked and the second on top only filled.
Because with some additional path segments one can even
switch between inside and outside, therefore one has access to
the other part of the stroke on top as well (tiny 1.1 has no *opacity
properties, therefore this causes no problems).
An entity extension of the DTD ist sometimes a good idea to
reuse path segments for this purpose.

As one can see, it is always simple to put the stroke below the
fill, but there are options as well to present only the inner or
the outer part of the stroke or an arbitrary fraction of it
(I have samples in a (german) tutorial, including continuous 
animation of the fraction ;o)

I think, for SVG 2 there are already modules in preparation
to provide some properties to make these things simpler - 
or at least often required use cases almost trivial ;o)

Olaf
Received on Saturday, 5 June 2010 11:09:54 GMT

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