Re: SVG spec--lines

On Friday, November 15, 2002, 11:01:14 PM, Andy wrote:


AS> Hi.  I'm confused by a couple of parts of the SVG spec.

AS> The 'line' element spec says:
AS> "Because 'line' elements are single lines and thus are geometrically
AS> one-dimensional, they have no interior; thus, 'line' elements are never
AS> filled (see the 'fill' property)."

AS> But the 'fill' property says:
AS> "The zero-width geometric outline of a shape is included in the area to be
AS> painted."

AS> This would give a definition to 'fill' for a line.

AS> Are these statements contradictory?  If so, which is correct?

They are not contradictory, but I do see what you mean in that
limiting case.

Rather like the concept of 'transparent black' which is not itself
useful except by derivation.

Consider a line from 0,0 to 100,100 and a polyline (or path) that
makes a triangle from 0,100 to 100, 0 to 100,100 both with a stroke
width of 20 and a polyline or path from 10,0 to 10,100.

The first statement says that the line, even if you adjust its
attributes through anmation or script, will always enclose no area.

It could have been described as enclosing a filled area of zero; but
instead we chose to say that it was never filled. The only practicval
upshot of thatwill be when considering pointer events.

The second statement is talking about the geometric shape of the
fill area and saying it is equal to the pure geometric shape of the
triangle, without considering stroke width, markers, etc. This has a
practical upshot as soon as you set fill:red; stroke:yellow;
stroke-opacity:0.2 so you can see the exact area filled.

And in the limiting case, when by script you add a third
(non-colinear) point to the polyline or path, or animate one of the
points of the triangle so that it is briefly colinear with the other
two during the animation, then the distinction makes sense.

AS> There does seem to be a fill in the Adobe viewer, because there is
AS> a line down the middle of my line when I make my line dashed and
AS> wide.

Whichever of the two possible definitions of the fill of a line
element had been chosen, according to sampling theory, the
contribution of the black line to the color of any pixel along its
length would be zero.

In practice, some graphics libraries have the concept of the
'hairline' or 'minimum width line' - remember the infamous 'zero width
lines' that so complicated peoples lives in the era of 300 dpi
postscript printers, when a photo typesetter was 1200dpi or better?
so, there will be artefacts in that case.

I discovered this artefact some time ago and did consider using it,
because i discovered it right after the ability to say
stroke-width:0.5px had been removed from the spec and I was sorely
missing my zoom-indifferent hairlines. But it was an artefact and not
reproducible on other implementations so I did not yield to temptation
;-)

AS> <svg width="592" height="473" viewBox="0 0 592 473">
AS> <g>
AS> <line stroke="#ff0000" x1="50" y1="200" x2="500" y2="200"
AS> stroke-dasharray="20 10" />
AS> </g>
AS> </svg>

AS> That line goes away when I set 'fill' to "none".

Or when you leave the fill as is and view it on a different viewer,
such as CSV.


PS taking a wild guess from your email address, if you are adding an
SVG output module to the Advanced Visualization System then, please
tell me when it is done.

-- 
 Chris                            mailto:chris@w3.org

Received on Friday, 15 November 2002 20:44:49 UTC