Xorn
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Attributes | List of all members
xornsch_path Struct Reference

Schematic path. More...

#include <xornstorage.h>

Public Attributes

struct xorn_string pathdata
 Path data. More...
 
int color
 Color index. More...
 
struct xornsch_line_attr line
 Line style. More...
 
struct xornsch_fill_attr fill
 Fill style. More...
 

Detailed Description

Schematic path.

Valid in schematic and symbol files. Valid since fileformat version 2 (release 1.5.1).

Definition at line 226 of file xornstorage.h.

Member Data Documentation

xornsch_path::color

Color index.

See also
gEDA colors

Definition at line 228 of file xornstorage.h.

xornsch_path::fill

Fill style.

Definition at line 230 of file xornstorage.h.

xornsch_path::line

Line style.

Definition at line 229 of file xornstorage.h.

xornsch_path::pathdata

Path data.

The gEDA path data format has been deliberately specified to match a subset of that in the W3C SVG standard.

As an implementation detail: libgeda takes code from librsvg, an SVG parsing library. As a result, the majority of SVG path syntax is read correctly, however this is always normalised to absolute move, line, Bézier curve and close-path commands internally (and is saved as such).

Coordinates along the path are specified in the standard gschem coordinate space.

Example:

M 410,240
L 501,200
L 455,295
L 435,265
z

A path starting at (410,240) with lines drawn from there, and joining points (501,200), (455,295), (435,265), closing back to its origin.

Those path commands which gEDA emits, and will guarantee to parse, are listed in the table below (text taken from the above SVG specification). In the table below, the following notation is used:

  • “()”: grouping of parameters
  • “+”: one or more of the given parameter(s) is required
CommandNameParametersDescription
M (absolute)moveto(x,y)+Start a new sub-path at the given (x,y) coordinate. M (uppercase) indicates that absolute coordinates will follow; m (lowercase) indicates that relative coordinates will follow. If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands.
L (absolute)lineto(x,y)+Draw a line from the current point to the given (x,y) coordinate which becomes the new current point. L (uppercase) indicates that absolute coordinates will follow; l (lowercase) indicates that relative coordinates will follow. A number of coordinates pairs may be specified to draw a polyline. At the end of the command, the new current point is set to the final set of coordinates provided.
C (absolute)curveto(x1,y1 x2,y2 x,y)+Draws a cubic Bézier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. C (uppercase) indicates that absolute coordinates will follow; c (lowercase) indicates that relative coordinates will follow. Multiple sets of coordinates may be specified to draw a polybézier. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybézier.
Z or zclosepathnone Close the current subpath by drawing a straight line from the current point to current subpath's initial point.

gEDA currently

  • emits only the absolute coordinate versions of the above commands
  • emits the commands, M, L, C before every set of coordinates, even where they could be omitted according to the SVG specification
  • places commas between x,y coordinates. These may be replaced with whitespace according to the SVG specification
  • doesn't support more than one sub-path
  • emits one path data line per command + coordinate set

As example, the path data of the outline of an AND gate is:

M 100,100
L 500,100
C 700,100 800,275 800,400
C 800,525 700,700 500,700
L 100,700
z

The resulting path (with control points drawn on to illustrate their positions) is shown here:

path_example_and_gate-smaller.png

Definition at line 227 of file xornstorage.h.


The documentation for this struct was generated from the following files: