Skip to content

Commit c947c65

Browse files
committed
Add clip method
1 parent dee2d2f commit c947c65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ipycanvas/canvas.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ def put_image_data(self, image_data, dx, dy):
160160
shape, image_buffer = array_to_binary(image_data)
161161
self._send_canvas_command('putImageData', ({'shape': shape}, dx, dy), (image_buffer, ))
162162

163+
# Clipping
164+
def clip(self):
165+
"""Turn the path currently being built into the current clipping path.
166+
167+
You can use clip() instead of close_path() to close a path and turn it into a clipping
168+
path instead of stroking or filling the path.
169+
"""
170+
self._send_canvas_command('clip')
171+
163172
# Transformation methods
164173
def save(self):
165174
"""Save the entire state of the canvas."""

0 commit comments

Comments
 (0)