:right-sidebar: True Stroke =================================================================== .. currentmodule:: gi.repository.Gsk .. versionadded:: 4.14 .. class:: Stroke(**kwargs) :no-contents-entry: A ``GskStroke`` struct collects the parameters that influence the operation of stroking a path. Constructors ------------ .. rst-class:: interim-class .. class:: Stroke :no-index: .. classmethod:: new(line_width: float) -> ~gi.repository.Gsk.Stroke Creates a new ``GskStroke`` with the given ``line_width``\. .. versionadded:: 4.14 :param line_width: line width of the stroke. Must be > 0 Methods ------- .. rst-class:: interim-class .. class:: Stroke :no-index: .. classmethod:: equal(stroke2: ~typing.Any = None) -> bool Checks if 2 strokes are identical. .. versionadded:: 4.14 :param stroke2: the second ``GskStroke`` .. method:: free() -> None Frees a ``GskStroke``\. .. versionadded:: 4.14 .. method:: get_dash() -> list[float] | None Gets the dash array in use or ``NULL`` if dashing is disabled. .. versionadded:: 4.14 .. method:: get_dash_offset() -> float Returns the dash_offset of a ``GskStroke``\. .. versionadded:: 4.14 .. method:: get_line_cap() -> ~gi.repository.Gsk.LineCap Gets the line cap used. See :obj:`~gi.repository.Gsk.LineCap` for details. .. versionadded:: 4.14 .. method:: get_line_join() -> ~gi.repository.Gsk.LineJoin Gets the line join used. See :obj:`~gi.repository.Gsk.LineJoin` for details. .. versionadded:: 4.14 .. method:: get_line_width() -> float Gets the line width used. .. versionadded:: 4.14 .. method:: get_miter_limit() -> float Returns the miter limit of a ``GskStroke``\. .. versionadded:: 4.14 .. method:: set_dash(dash: list[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`` or ``GSK_LINE_CAP_SQUARE`` to draw dots or squares along a path. If ``n_dash`` is 0, if all elements in ``dash`` are 0, or if there are negative values in ``dash``\, 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 in ``dash`` defining an "on" or "off" in alternating passes through the array. You can specify a starting offset into the dash with :obj:`~gi.repository.Gsk.Stroke.set_dash_offset`\. .. versionadded:: 4.14 :param dash: the array of dashes .. method:: 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 :obj:`~gi.repository.Gsk.Stroke.set_dash` for more details on dashing. .. versionadded:: 4.14 :param offset: offset into the dash pattern .. method:: set_line_cap(line_cap: ~gi.repository.Gsk.LineCap) -> None Sets the line cap to be used when stroking. See :obj:`~gi.repository.Gsk.LineCap` for details. .. versionadded:: 4.14 :param line_cap: the ``GskLineCap`` .. method:: set_line_join(line_join: ~gi.repository.Gsk.LineJoin) -> None Sets the line join to be used when stroking. See :obj:`~gi.repository.Gsk.LineJoin` for details. .. versionadded:: 4.14 :param line_join: The line join to use .. method:: set_line_width(line_width: float) -> None Sets the line width to be used when stroking. The line width must be > 0. .. versionadded:: 4.14 :param line_width: width of the line in pixels .. method:: 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 type ``GSK_LINE_JOIN_BEVEL``\. .. versionadded:: 4.14 :param limit: the miter limit .. method:: to_cairo(cr: ~gi.repository.cairo.Context) -> None A helper function that sets the stroke parameters of ``cr`` from the values found in ``self``\. .. versionadded:: 4.14 :param cr: the cairo context to configure