putImageData method
Paints the data from a specified CanvasImageData object onto a canvas.
Syntax
object.putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
Parameters
imagedata [in]
Type: ICanvasImageDataA CanvasImageData object with an image's pixel data.
dx [in]
Type: numberThe x-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
dy [in]
Type: numberThe y-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.
dirtyX [in, optional]
Type: numberThe horizontal (x) value, in CSS pixels, where to place the image on the canvas.
dirtyY [in, optional]
Type: numberThe vertical (y) value, in CSS pixels, where to place the image on the canvas.
dirtyWidth [in, optional]
Type: numberThe destination width value, in CSS pixels, to use to draw the image to the canvas.
dirtyHeight [in, optional]
Type: numberThe destination height value, in CSS pixels to use to draw the image to the canvas.
Return value
This method does not return a value.
Exceptions
The following exceptions can be thrown:
Exception | Condition |
---|---|
NotSupportedError | One of the parameters is infinite or not a number (NaN). |
TypeMismatchError | The first parameter is not an CanvasImageData object. |
SecurityError | The image is not of the same origin or domain as the destination. |
Standards information
- HTML Canvas 2D Context, Section 13
Remarks
You can specify an optional rectangle to show only those pixels. This "dirty" rectangle refers to a section of pixels to paint. You can use this option to specify areas on an image that might change without repainting the complete image.