Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def put_image_data(self, image_data, x=0, y=0):
"""Draw an image on the Canvas.
``image_data`` should be a NumPy array containing the image to draw and ``x`` and ``y`` the pixel position where to
draw. Unlike the CanvasRenderingContext2D.putImageData method, this method **is** affected by the canvas transformation
matrix, and supports transparency.
"""
image_metadata, image_buffer = binary_image(image_data)
self._send_canvas_command('putImageData', (image_metadata, x, y), (image_buffer, ))