getImageData method

ImageData getImageData(
  1. int sx,
  2. int sy,
  3. int sw,
  4. int sh, [
  5. ImageDataSettings settings,
])

The CanvasRenderingContext2D method getImageData() of the Canvas 2D API returns an ImageData object representing the underlying pixel data for a specified portion of the canvas.

This method is not affected by the canvas's transformation matrix. If the specified rectangle extends outside the bounds of the canvas, the pixels outside the canvas are transparent black in the returned ImageData object.

Note: Image data can be painted onto a canvas using the CanvasRenderingContext2D.putImageData method.

You can find more information about getImageData() and general manipulation of canvas contents in Pixel manipulation with canvas.

Implementation

external ImageData getImageData(
  int sx,
  int sy,
  int sw,
  int sh, [
  ImageDataSettings settings,
]);