From Inkscape Wiki
Jump to: navigation, search

Stock Library Interface

For various kinds of objects (e.g. markers, gradients, and so forth) that we want to reuse from a standard inkscape library, when used, we need some means to include them in the document if and only if they have not already been included.

The proposal:

SPDocument will have a get_stock(stockid) method, which will return an SPObject corresponding to the specified stock id, copying the stock item into the document if it has not already been created.

Stock ids will be URIs -- stuff from the builtin Inkscape stock library will be named with URNs in the form: urn:inkscape-stock:base:id; for example, the marker with id "foo" in markers.svg would have the URN urn:inkscape-stock:markers:foo.

When added to the document, such stock items will get an inkscape:stockid attribute indicating their stock id (so they won't be re-added with the next use of that stock item). This also permits customizing stock items on a per-document basis if desired.


With regard to stock library items -- wouldn't URNs like urn:inkscape-stock:markers#foo make more sense? The "foo" is, after all, a fragment id.