Phaser API Documentation

  Version: 
getPixel(x, y, key, [frame])

Description:

Given a Texture and an x and y coordinate this method will return a new Color object that has been populated with the color and alpha values of the pixel at that location in the Texture.

Parameters:

name type arguments description
x number

The x coordinate of the pixel within the Texture.

y number

The y coordinate of the pixel within the Texture.

key string

The unique string-based key of the Texture.

frame string | number <optional>

The string or index of the Frame.

Returns:
Description:

A Color object populated with the color values of the requested pixel, or null if the coordinates were out of bounds.

Since: 3.0.0