A.4 Defs, View, and Metadata

Now let’s descend from the root element of a typical Inkscape SVG document to see what else is in there.

First comes the defs element. As part of the SVG standard, it is a storage bin for things that, by themselves, are not displayed on the canvas, but may be used by other elements that are. This includes gradients, patterns, markers (arrowheads, 9.5 Markers), clipping paths, masks, filters, and so on. They are all stored as child elements of the defs element. The SVG specification allows arbitrarily many defs elements placed almost anywhere in the document, but Inkscape always uses a single defs under the root svg. Here’s an example defs element containing a gradient:

<defs id="defs4"> <linearGradient inkscape:collect="always" ...

Get The Book of Inkscape now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.