Stroke
Added in version 4.14.
- class Stroke(**kwargs)
A GskStroke
struct collects the parameters that influence
the operation of stroking a path.
Constructors
Methods
- class Stroke
- equal(stroke1: None, stroke2: None) bool
Checks if 2 strokes are identical.
Added in version 4.14.
- Parameters:
stroke1 – the first
GskStroke
stroke2 – the second
GskStroke
- get_dash() list[float] | None
Gets the dash array in use or
NULL
if dashing is disabled.Added in version 4.14.
- get_line_join() LineJoin
Gets the line join used.
See
LineJoin
for details.Added in version 4.14.
- set_dash(dash: Sequence[float] | None = None) None
Sets the dash pattern to use by this stroke.
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
GSK_LINE_CAP_ROUND
orGSK_LINE_CAP_SQUARE
to draw dots or squares along a path.If
n_dash
is 0, if all elements indash
are 0, or if there are negative values indash
, then dashing is disabled.If
n_dash
is 1, an alternating “on” and “off” pattern with the single dash length provided is assumed.If
n_dash
is uneven, the dash array will be used with the first element indash
defining 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_dash
for 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
LineCap
for details.Added in version 4.14.
- Parameters:
line_cap – the
GskLineCap
- set_line_join(line_join: LineJoin) None
Sets the line join to be used when stroking.
See
LineJoin
for 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 limit for the distance from the corner where sharp turns of joins get cut off.
The miter limit is in units of line width and must be non-negative.
For joins of type
GSK_LINE_JOIN_MITER
that exceed the miter limit, the join gets rendered as if it was of typeGSK_LINE_JOIN_BEVEL
.Added in version 4.14.
- Parameters:
limit – the miter limit