1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
Path
====
.. autoclass:: svgwrite.path.Path
.. seealso:: http://www.w3.org/TR/SVG11/paths.html#PathElement
.. automethod:: svgwrite.path.Path.__init__
Attributes
----------
.. attribute:: commands
`list` -- the command and coordinate stack
Methods
-------
.. automethod:: svgwrite.path.Path.push
.. automethod:: svgwrite.path.Path.push_arc
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.Transform`
* :class:`svgwrite.mixins.Presentation`
* :class:`svgwrite.mixins.Markers`
.. _pathCommands:
Path Commands
-------------
.. seealso:: http://www.w3.org/TR/SVG11/paths.html#PathData
Uppercase commands indicates absolute coordinates, lowercase commands
indicates relative coordinates
* **horizontal-line 'h', 'H' x+**
Draws a horizontal line from the current point (cpx, cpy) to (x, cpy).
* **vertical-line 'v', 'V' y+**
Draws a vertical line from the current point (cpx, cpy) to (cpx, y).
* **line 'l', 'L' (x y)+**
Draw a line from the current point to the given (x,y) coordinate.
* **moveto 'm', 'M' (x y)+**
Start a new sub-path at the given (x,y) coordinate.
If a moveto is followed by multiple pairs of coordinates, the subsequent
pairs are treated as implicit lineto commands. Hence, implicit lineto
commands will be relative if the moveto is relative, and absolute if the
moveto is absolute. If a relative moveto (m) appears as the first element
of the path, then it is treated as a pair of absolute coordinates.
In this case, subsequent pairs of coordinates are treated as relative even
though the initial moveto is interpreted as an absolute moveto.
* **cubic-bezier-curve 'c', 'C' (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.
* **smooth-cubic-bezier-curve 's', 'S' (x2 y2 x y)+**
Draws a cubic Bézier curve from the current point to
(x,y). The first control point is assumed to be the reflection of the second
control point on the previous command relative to the current point. (If
there is no previous command or if the previous command was not an C, c,
S or s, assume the first control point is coincident with the current point.)
(x2,y2) is the second control point (i.e., the control point at the end of
the curve).
* **quadratic-bezier-curve 'q', 'Q' (x1 y1 x y)+**
Draws a quadratic Bézier curve from the current point
to (x,y) using (x1,y1) as the control point.
* **smooth-quadratic-bezier-curve 't', 'T' (x y)+**
Draws a quadratic Bézier curve from the current point to (x,y).
The control point is assumed to be the reflection of the control point on
the previous command relative to the current point. (If there is no previous
command or if the previous command was not a Q, q, T or t, assume the control
point is coincident with the current point.)
* **elliptical-arc 'a', 'A' (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+**
Draws 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,
which indicates how the ellipse as a whole is rotated relative to the
current coordinate system. The center (cx, cy) of the ellipse is
calculated automatically to satisfy the constraints imposed by the other
parameters. large-arc-flag and sweep-flag contribute to the automatic
calculations and help determine how the arc is drawn.
* **'z', 'Z'**
close current subpath
SVG Attributes
--------------
* **class** -- `string`
assigns one or more css-class-names to an element
* **style** -- `string`
allows per-element css-style rules to be specified directly on a given element
* **externalResourcesRequired** -- `bool`
*False*: if document rendering can proceed
even if external resources are unavailable else: *True*
* **transform** -- use :class:`svgwrite.mixins.Transform` methods
* **pathLength** -- `<number>`
the *pathLength* attribute can be used to provide the author's
computation of the total length of the path so that the user agent can
scale distance-along-a-path computations by the ratio of 'pathLength' to
the user agent's own computed value for total path length.
A "moveto" operation within a 'path' element is defined to have zero length.
* **d** -- `string`
The definition of the outline of a shape, use push-method to add commands
and coordinates
Standard SVG Attributes
-----------------------
* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Graphical Event Attributes </attributes/graphical_event>`
* :doc:`Presentation Attributes </attributes/presentation>`
|