Phaser API Documentation

  Version: 
getData(x, y, width, height)

Description:

Gets an ImageData region from this CanvasTexture from the position and size specified. You can write this back using CanvasTexture.putData, or manipulate it.

Parameters:

name type description
x number

The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer.

y number

The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer.

width number

The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.

height number

The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.

Returns:
Description:

The ImageData extracted from this CanvasTexture.

Type:
  • ImageData
Since: 3.16.0