Phaser API Documentation

  Version: 
setPixel(x, y, red, green, blue, [alpha])

Description:

Sets a pixel in the CanvasTexture to the given color and alpha values.

This is an expensive operation to run in large quantities, so use sparingly.

Parameters:

name type arguments Default 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.

red number

The red color value. A number between 0 and 255.

green number

The green color value. A number between 0 and 255.

blue number

The blue color value. A number between 0 and 255.

alpha number <optional> 255

The alpha value. A number between 0 and 255.

Returns:
Description:

This CanvasTexture.

Examples:
Since: 3.16.0