getImageData method

Returns an ICanvasImageData object that represents the pixel data for the specified rectangle on a canvas. Use the data property to get a CanvasPixelArray to manipulate individual pixel data.

 

Syntax

ICanvasImageData retVal = object.getImageData(sx, sy, sw, sh);

Parameters

  • sx [in]
    Type: number

    The x-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.

  • sy [in]
    Type: number

    The y-coordinate, in pixels, of the upper-left corner of the rectangle in relation to the coordinates of the canvas.

  • sw [in]
    Type: number

    The width, in pixels, of the rectangle in relation to the coordinates of the canvas.

  • sh [in]
    Type: number

    The height, in pixels, of the rectangle in relation to the coordinates of the canvas.

Standards information

Remarks

If the rectangle contains pixels outside the canvas, they are returned as transparent black.

See also

CanvasPixelArray

ICanvasRenderingContext2D::putImageData

ICanvasImageData::data