Stroke#
Added in version 4.14.
- class Stroke(**kwargs)#
Collects the parameters that are needed when stroking a path.
Constructors#
Methods#
- class Stroke
- classmethod equal(stroke1: Any = None, stroke2: Any = None) bool#
Checks if two strokes are identical.
Added in version 4.14.
- Parameters:
stroke1 – the first stroke
stroke2 – the second stroke
- set_dash(dash: list[float] | None = None) None#
Sets the dash pattern to use.
A dash pattern is specified by an array of alternating non-negative values. Each value provides the length of alternate “on” and “off” portions of the stroke.
Each “on” segment will have caps applied as if the segment were a separate contour. In particular, it is valid to use an “on” length of 0 with
roundorsquareto draw dots or squares along a path.If
n_dashis 0, if all elements indashare 0, or if there are negative values indash, then dashing is disabled.If
n_dashis 1, an alternating “on” and “off” pattern with the single dash length provided is assumed.If
n_dashis uneven, the dash array will be used with the first element indashdefining an “on” or “off” in alternating passes through the array.You can specify a starting offset into the dash with
set_dash_offset.Added in version 4.14.
- Parameters:
dash – the array of dashes
- set_dash_offset(offset: float) None#
Sets the offset into the dash pattern where dashing should begin.
This is an offset into the length of the path, not an index into the array values of the dash array.
See
set_dashfor more details on dashing.Added in version 4.14.
- Parameters:
offset – offset into the dash pattern
- set_line_cap(line_cap: LineCap) None#
Sets the line cap to be used when stroking.
See
LineCapfor details.Added in version 4.14.
- Parameters:
line_cap – the line cap
- set_line_join(line_join: LineJoin) None#
Sets the line join to be used when stroking.
See
LineJoinfor details.Added in version 4.14.
- Parameters:
line_join – the line join to use
- set_line_width(line_width: float) None#
Sets the line width to be used when stroking.
The line width must be >= 0.
Added in version 4.14.
- Parameters:
line_width – width of the line in pixels
- set_miter_limit(limit: float) None#
Sets the miter limit to be used when stroking.
The miter limit is the distance from the corner where sharp turns of joins get cut off.
The limit is specfied in units of line width and must be non-negative.
For joins of type
miterthat exceed the miter limit, the join gets rendered as if it was of typebevel.Added in version 4.14.
- Parameters:
limit – the miter limit