Name
CRC.putImageData() — copies pixels from an ImageData into the canvas
Synopsis
void putImageData(ImageDatadata, floatdx, floatdy, floatsx, floatsy, floatsw, floatsh)
Arguments
dataAn ImageData object.
dx,dyThe coordinates of a
destinationpoint in the canvas. Pixels fromdatawill be copied to the canvas starting at this point. These arguments are not transformed by the current transformation matrix.sx,sy,sw,shThese optional arguments specify a source rectangle within the ImageData. If specified, only the pixels within that rectangle will be copied to the canvas. If omitted, all pixels in the ImageData will be copied. If these arguments specify a rectangle that exceeds the bounds of the ImageData, the rectangle will be clipped to those bounds. Negative values for
sxandsyare allowed.
Description
putImageData() copies a rectangular block of
pixels from an ImageData object onto the canvas. This is a low-level
pixel copy operation: the globalCompositeOperation
and globalAlpha attributes are ignored as are the
clipping region, transformation matrix, and shadow-drawing
attributes.
One use for ImageData objects is as a “backing store” for a
canvas—saving a copy of the canvas
pixels in an ImageData object (using getImageData()) allows you to draw temporarily on
the canvas and then restore it to its original state with
putImageData().
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access