5.6 Path
A Path represents a set of figures defined by curves. A path can be used with the DC.path method of a drawing context to draw the path’s curves as lines, fill the region bounded by the path’s curves, or both. A path can also be used with the Region.path method to generate a region bounded by the path’s curves.
A path consists of zero or more closed subpaths, and possibly one open subpath. Some Path methods extend the open subpath, some methods close the open subpath, and some methods add closed subpaths. This approach to drawing formulation is inherited from PostScript.
When a path is drawn as a line, a closed subpath is drawn as a closed figure, analogous to a polygon. An open subpath is drawn with disjoint start and end points, analogous lines drawn with DC.lines.
When a path is filled or used as a region, the open subpath (if any) is treated as if it were closed. The content of a path is determined either through the #'even_odd rule or the #'winding rule, as selected at the time when the path is filled or used to generate a region.
A path is not connected to any particular DC object, so setting a DC transformation does not affect path operations. Instead, a DC’s transformation applies at the time that the path is drawn or used to set a region.
method | |
| |
method | |
| |
method | |
method | ||||
| ||||
method | ||||
| ||||
method | ||||
method | ||||||
|
method | ||||||
|
If radius is positive, the value is used as the radius of the rounded corner. If radius is negative, the absolute value is used as the proportion of the smallest dimension of the rectangle.
If radius is less than -0.5 or more than half of the width or height (respectively) of r, then half of the width or height (respectively) of r is used, instead.
method | ||||||
If the path has no open subpath, a new one is started with the arc’s starting point. Otherwise, the arc extends the existing sub-path, and the existing path is connected with a line to the arc’s starting point.
method | ||||||||
|
method | |
| |
method | |
| |
| |
method | |
| |
method | |
| |
| |
method | |
|
Closed subpaths of path are added as closed subpaths to path. If both paths have an open subpath, then this path’s open subpath is extended by the given path’s open subpath, adding a line from this path’s current ending point to the given path’s starting point. If only one of the paths has an open subpath, then it becomes (or remains) the path’s open subpath.
property | |
| |
function | |