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
Stroke multiple polygons at once where each polygon can have its own color.
101
+
See :ref:`styled_polygons` for details.
102
+
88
103
89
104
.. code:: Python
90
105
@@ -146,6 +161,10 @@ There are methods that draw arcs/circles on the canvas:
146
161
Draw filled arcs centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` and other arguments are NumPy arrays, lists or scalar values.
147
162
- ``stroke_arcs(x, y, radius, start_angle, end_angle, anticlockwise=False)``:
148
163
Draw an arc outlines centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` and other arguments are NumPy arrays, lists or scalar values.
164
+
- ``fill_styled_arcs( x, y, radius, start_angle, end_angle, color, alpha, anticlockwise=False)``:
165
+
Same as ``fill_arcs`` but with additional ``(n x 3)`` ``color`` ndarray and ``(n)`` ``alpha`` ndarray.
166
+
- ``stroke_styled_arcs( x, y, radius, start_angle, end_angle, color, alpha, anticlockwise=False)``:
167
+
Same as ``stroke_arcs`` but with additional ``(n x 3)`` ``color`` ndarray and ``(n)`` ``alpha`` ndarray.
149
168
150
169
- ``fill_circle(x, y, radius)``:
151
170
Draw a filled circle centered at ``(x, y)`` with a radius of ``radius``.
@@ -155,7 +174,10 @@ There are methods that draw arcs/circles on the canvas:
155
174
Draw filled circles centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` are NumPy arrays, lists or scalar values.
156
175
- ``stroke_circles(x, y, radius)``:
157
176
Draw a circle outlines centered at ``(x, y)`` with a radius of ``radius``. Where ``x``, ``y``, ``radius`` are NumPy arrays, lists or scalar values.
158
-
177
+
- ``fill_styled_circles( x, y, radius color, alpha)`` :
178
+
Same as ``fill_circles`` but with additional ``(n x 3)`` ``color`` ndarray and ``(n)`` ``alpha`` ndarray.
179
+
- ``stroke_styled_circles( x, y, radius, color, alpha)`` :
180
+
Same as ``stroke_circles`` but with additional ``(n x 3)`` ``color`` ndarray and ``(n)`` ``alpha`` ndarray.
159
181
160
182
.. code:: Python
161
183
@@ -184,6 +206,10 @@ There are two commands for drawing a straight line from one point to another:
184
206
Draw a line from ``(x1, y1)`` to ``(x2, y2)``.
185
207
- ``stroke_lines(points)``:
186
208
Draw a path of consecutive lines from a list of points ``[(x1, y1), (x2, y2), ..., (xn, yn)]``.
Draw multiple disconnected line-segments at once. See :ref:`styled_polygons` for details.
187
213
188
214
.. code:: Python
189
215
@@ -228,7 +254,7 @@ There are two commands for drawing a straight line from one point to another:
228
254
Vectorized methods
229
255
------------------
230
256
231
-
Some methods like ``fill_rect`` and ``fill_circle`` have a vectorized counterpart: ``fill_rects`` and ``fill_circles``. It is essential
257
+
Most methods like ``fill_rect``/``stroke_rect`` and ``fill_circle``/``stroke_circle`` have vectorized counterparts: ``fill_rects``/``stroke_rects`` and ``fill_circles``/``stroke_circles``. It is essential
232
258
to use those methods when you want to draw the same shape multiple times with the same style.
233
259
234
260
For example, it is way faster to run:
@@ -265,3 +291,252 @@ instead of running:
265
291
canvas.fill_rect(position, position, size)
266
292
267
293
canvas
294
+
295
+
296
+
.. _styled_vectorized_methods:
297
+
298
+
Styled vectorized methods
299
+
------------------------------------
300
+
301
+
Ipycanvas provides methods to draw the same shape multiple times but with different colors:
0 commit comments