BitmapData#getPixel()

getPixel(x, y, out) → {object}

Get the color of a specific pixel in the context into a color object.
If you have drawn anything to the BitmapData since it was created you must call BitmapData.update to refresh the array buffer,
otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist.

Parameters
Name Type Argument Description
x number

The x coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.

y number

The y coordinate of the pixel to be set. Must lay within the dimensions of this BitmapData.

out object <optional>

An object into which 4 properties will be created: r, g, b and a. If not provided a new object will be created.

Returns
object -

An object with the red, green, blue and alpha values set in the r, g, b and a properties.

Source code: gameobjects/BitmapData.js (Line 985)
doc_phaser
2017-02-14 10:37:02
Comments
Leave a Comment

Please login to continue.