loge.hixie.ch

Hixie's Natural Log

2004-10-27 07:26 UTC Closed shapes and defaults

SVG has two related elements for drawing shapes consisting of points joined by straight lines.

The second is polygon. By default, it draws a black filled polygon using the points you gave it as the points for the edge of the shape.

The first is polyline. By default, it draws a black filled polygon using the points you gave it as the points for the edge of the shape.

In fact the difference between a polyline and a polygon only becomes visible if you explicitly disable filling on the elements, and explicitly turn on stroking. And then the difference is only a single line (the line that closes the polygon from the last point to the first).

(One wonders if maybe the SVG UA default stylesheet for polyline couldn't have had, e.g., fill: none; stroke: black, to ensure that the line version actually looked like a line... Too late to change now, of course.)