11.3.2. Recognised drawing elements

Dia

11.3.2. Recognised drawing elements

The recognised drawing elements are:

  • <svg:g>

    This is the group element. You can place other drawing elements inside it. The contents of the style attribute on a group element will propagate to the contained elements (unless they override it).

  • <svg:line x1="..." y1="..." x2="..." y2="..."/>

    This element is a line.

  • <svg:polyline points="...."/>

    This is a polyline. That is, a number of connected line segments. The points attribute holds the coordinates of the end points for the line segments. The coordinates are separated by white space or commas. The suggested format is "x1,y1 x2,y2 x3,y3 ...".

  • <svg:polygon points="...."/>

    This is a polygon. The points argument has the same format as the polyline.

  • <svg:rect x1="..." y1="..." width="..." height="..."/>

    This is a rectangle. The upper left corner is (x1,y1), and the lower right corner is (x1+width,y1+height).

  • <svg:image x1="..." y1="..." width="..." height="..." xlink:href="..." />

    This is an external image. The upper left corner is (x1,y1), and the lower right corner is (x1+width,y1+height). Their are two forms of links supported, an absolute filename of the form "file:///home/user/image.png" or a relative one without the "file://" prefix like in "image.png". The latter form is preferred because it is installation independent. The filename is relative to the shape file placement. In the above example PNG and shape need to be in the same directory.

  • <svg:circle cx="..." cy="..." r="..."/>

    This is a circle with centre (cx,cy) and radius r.

  • <svg:ellipse cx="..." cy="..." rx="..." ry="..."/>

    This is a ellipse with centre (cx, cy) and radius rx in the x direction and ry in the y direction.

  • <svg:path d="...."/>

    This is the most complicated drawing element. It describes a path made up of line segments and bezier curves. It currently does not support the elliptic arc or quadratic bezier curves. The d string is made up of a number of commands of the form "x arg1 arg2 ..." where x is a character code identifying the command, and the arguments are numbers separated by white space or commas. Each command has an absolute and relative variant. The absolute one are spelled with an upper case letter. The relative ones are spelled with a lower case letter, and use the end point of the previous command as the origin.

    The supported commands are:

    • M x,y - Move cursor
    • L x,y - Draw a line to (x,y)
    • H x - Draw a horizontal line to x
    • V y - Draw a vertical line to y
    • C x1,y1 x2,y2, x3,y3 - Draw a bezier curve to (x3,y3) with (x1,y1) and (x2,y2) as control points. C (uppercase) indicates that absolute coordinates will follow; c (lowercase) indicates that relative coordinates will follow.
    • S x1,y1 x2,y2 - Same as above, but draw a `smooth' bezier. That is, infer the first control point from the previous bezier. S (uppercase) indicates that absolute coordinates will follow; s (lowercase) indicates that relative coordinates will follow.
    • A (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ - Draw an elliptical arc from the current point to (x, y). The size and orientation of the ellipse are defined by two radii (rx, ry) and an x-axis-rotation. The center is automatically calculated. large-arc-flag and sweep-flag contribute to the automatic calculations and help determine how the arc is drawn. A (uppercase) indicates that absolute coordinates will follow; a (lowercase) indicates that relative coordinates will follow.
    • Z - Close the path.
    If the path is closed with z or Z, then it can be filled. Otherwise, it will just be drawn.

  • <svg:text x="..." y="..." style="...">...</svg:text>

    A text in the shape. The text has to be enclosed in the tags

    The parameters are:

    • x,y - The text position
    • style - Text formatting options

      The following style options are supported:

      • font-size - font size in pt