A shape consists of at least a name and a SVG element. That is, every
shape, at a minimum, has a name and a description:
<name>Sample - Minimal Shape</name>
<svg:svg width="10" height="10">
<svg:polygon points="0,0 10,0 5,10"/>
You can place this in a subdirectory of your own dia
directory, perhaps called Sample as in
/.dia/shapes/Sample/minimal.shape. The actual filename in
which the shape is stored (minimal.shape) is not so
will find the file.
Now you need to create a sheet into which this shape is placed. Again,
a sheet is specified using XML. This example is placed in the file
<?xml version="1.0" encoding="iso-8859-1"?>
<description>A collection of sample shapes.</description>
<object name="Sample - Minimal Shape">
<description>The most minimal of shapes</description>
Now start up dia
and you should see this new sheet, called
Sample, containing a single button with a default icon.
You can now create a new canvas and add this shape to your canvas.
Note that dia
takes care of the resizing of the shape and
the other characteristics.
The XML describing the shape begins with the usual xml meta
element followed the actual shape element, identifying the
appropriate XML namespaces (xmlns). The shape has a unique
name used to identify the shape by dia. Next we have the
actual SVG description of the shape which is 10 by 10 in size
(actually these are ignored by dia
but are required by the
SVG format), and consisting of a single polygon. The shape is a simple
triangle (a polygon with three points) pointing downwards. The polygon
is drawn from the top left corner (0,0) to the top right (10,0) then
to the bottom middle (5,10) and then back to the top left to finish
off the polygon.
The XML for the sheet then identifies this shape as belonging to the
Sample sheet, which contains just one object, the Sample
- Minimal Shape shape. The description for the object is used as
the tooltip for the resulting button.
Copyright © 1995-2006 [email protected]