You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/drawing_paths.rst
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,8 @@ Using the Path2D class is very useful and efficient when you want to reuse the s
11
11
12
12
See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths for documentation about SVG paths.
13
13
14
-
- ``Path2D(value)``: Creates a Path2D given the SVG path string value.
14
+
- ``Path2D(value)``:
15
+
Creates a Path2D given the SVG path string value.
15
16
16
17
.. code:: Python
17
18
@@ -55,14 +56,14 @@ extra steps:
55
56
Here are the functions used to perform these steps:
56
57
57
58
- ``begin_path()``:
58
-
Creates a new path. Once created, future drawing commands are directed into the path and used to build the path up.
59
+
Creates a new path. Once created, future drawing commands are directed into the path and used to build the path up.
59
60
- Path commands like ``line_to`` and ``arc``
60
61
- ``close_path()``:
61
-
Adds a straight line to the path, going to the start of the current path.
62
+
Adds a straight line to the path, going to the start of the current path.
62
63
- ``stroke()``:
63
-
Draws the shape by stroking its outline.
64
+
Draws the shape by stroking its outline.
64
65
- ``fill(rule)``:
65
-
Draws a solid shape by filling the path's content area. The given fill rule is applied, possible rules are `nonzero` and `evenodd`.
66
+
Draws a solid shape by filling the path's content area. The given fill rule is applied, possible rules are `nonzero` and `evenodd`.
66
67
67
68
.. code:: Python
68
69
@@ -88,27 +89,27 @@ Path commands
88
89
Here are the available draw commands:
89
90
90
91
- ``move_to(x, y)``:
91
-
Moves the pen to the coordinates specified by x and y. This does not actually draw anything.
92
+
Moves the pen to the coordinates specified by x and y. This does not actually draw anything.
92
93
- ``line_to(x, y)``:
93
-
Add a straight line to the current path by connecting the path’s last point to the specified (x, y) coordinates.
94
+
Add a straight line to the current path by connecting the path’s last point to the specified (x, y) coordinates.
94
95
- ``arc(x, y, radius, start_angle, end_angle, anticlockwise=False)``:
95
-
Add a circular arc centered at (x, y) with a radius
96
-
of ``radius`` to the current path. The path starts at ``start_angle`` and ends at ``end_angle`` in radians, and travels in the direction given by
97
-
``anticlockwise`` (defaulting to clockwise: False).
96
+
Add a circular arc centered at (x, y) with a radius
97
+
of ``radius`` to the current path. The path starts at ``start_angle`` and ends at ``end_angle`` in radians, and travels in the direction given by
98
+
``anticlockwise`` (defaulting to clockwise: False).
98
99
- ``arc_to(x1, y1, x2, y2, radius)``:
99
-
Add a circular arc to the current path. Using the given control points (``x1``, ``y1``)
100
-
and (``x2``, ``y2``) and the ``radius``.
100
+
Add a circular arc to the current path. Using the given control points (``x1``, ``y1``)
101
+
and (``x2``, ``y2``) and the ``radius``.
101
102
- ``ellipse(x, y, radius_x, radius_y, rotation, start_angle, end_angle, anticlockwise=False)``:
102
-
Add an ellipse centered at ``(x, y)`` with
103
-
the radii ``radius_x`` and ``radius_y`` to the current path.
103
+
Add an ellipse centered at ``(x, y)`` with
104
+
the radii ``radius_x`` and ``radius_y`` to the current path.
104
105
- ``quadratic_curve_to(cp1x, cp1y, x, y)``:
105
-
Add a quadratic Bezier curve to the current path.
106
-
It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using ``move_to()`` before creating the quadratic Bezier curve.
106
+
Add a quadratic Bezier curve to the current path.
107
+
It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using ``move_to()`` before creating the quadratic Bezier curve.
It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using ``move_to()`` before creating the Bezier curve.
109
+
Add a cubic Bezier curve to the current path.
110
+
It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using ``move_to()`` before creating the Bezier curve.
110
111
- ``rect(x, y, width, height)``:
111
-
Draws a rectangle whose top-left corner is specified by (``x``, ``y``) with the specified ``width`` and ``height``.
112
+
Draws a rectangle whose top-left corner is specified by (``x``, ``y``) with the specified ``width`` and ``height``.
0 commit comments