Phaser API Documentation

  Version: 
getIndex(x, y)

Description:

Returns the Image Data index for the given pixel in this CanvasTexture.

The index can be used to read directly from the this.data array.

The index points to the red value in the array. The subsequent 3 indexes point to green, blue and alpha respectively.

Parameters:

name type description
x number

The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer.

y number

The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer.

Type:
  • number
Examples:
Since: 3.16.0