The class pathitem is the superclass of all PostScript path
construction primitives. It is never used directly, but only by
instantiating its subclasses, which correspond one by one to the
PostScript primitives.
Except for the path elements ending in _pt, all coordinates
passed to the path elements can be given as number (in which case they
are interpreted as user units with the currently set default type) or in
PyX lengths.
The following operation move the current point and open a new subpath:
-
-
Path element which sets the current point to the absolute coordinates (x,
y). This operation opens a new subpath.
-
-
Path element which moves the current point by (dx, dy).
This operation opens a new subpath.
Drawing a straight line can be accomplished using:
-
-
Path element which appends a straight line from the current point to the
point with absolute coordinates (x, y), which becomes
the new current point.
-
-
Path element which appends a straight line from the current point to the
a point with relative coordinates (dx, dy), which becomes
the new current point.
For the construction of arc segments, the following three operations
are available:
| class arc( |
x, y, r, angle1, angle2) |
-
Path element which appends an arc segment in counterclockwise direction
with absolute coordinates (x, y) of the center and
radius r from angle1 to angle2 (in degrees).
If before the operation, the current point is defined, a straight line
is from the current point to the beginning of the arc segment is
prepended. Otherwise, a subpath, which thus is the first one in the
path, is opened. After the operation, the current point is at the end
of the arc segment.
| class arcn( |
x, y, r, angle1, angle2) |
-
Path element which appends an arc segment in clockwise direction
with absolute coordinates (x, y) of the center and
radius r from angle1 to angle2 (in degrees).
If before the operation, the current point is defined, a straight line
is from the current point to the beginning of the arc segment is
prepended. Otherwise, a subpath, which thus is the first one in the
path, is opened. After the operation, the current point is at the end
of the arc segment.
| class arct( |
x1, y1, x2, y2, r) |
-
Path element which appends an arc segment of radius r
connecting between (x1, y1) and (x2, y2).
Bézier curves can be constructed using:
| class curveto( |
x1, y1, x2, y2, x3, y3) |
-
Path element which appends a Bézier curve with
the current point as first control point and the other control points
(x1, y1), (x2, y2), and (x3, y3).
| class rcurveto( |
dx1, dy1, dx2, dy2, dx3, dy3) |
-
Path element which appends a Bézier curve with
the current point as first control point and the other control points
defined relative to the current point by the coordinates
(dx1, dy1), (dx2, dy2), and (dx3, dy3).
Note that when calculating the bounding box (see Sect. 10) of
Bézier curves, PyX uses for performance reasons the so-called
control box, i.e., the smallest rectangle enclosing the four control
points of the Bézier curve. In general, this is not the smallest
rectangle enclosing the Bézier curve.
Finally, an open subpath can be closed using:
-
-
Path element which closes the current subpath.
For performance reasons, two non-PostScript path elements are defined,
which perform multiple identical operations:
-
-
Path element which appends straight line segments starting from
the current point and going through the list of points given
in the points_pt argument. All coordinates have to
be given in PostScript points.
-
-
Path element which appends Bézier curve segments starting from
the current point and going through the list of each three control
points given in the points_pt argument.