BitmapData#getPixelRGB()

getPixelRGB(x, y, out, hsl, hsv) → {object}

Get the color of a specific pixel including its alpha value as a color object containing r,g,b,a and rgba properties.
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 Default 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 3 properties will be created: r, g and b. If not provided a new object will be created.

hsl boolean <optional>
false

Also convert the rgb values into hsl?

hsv boolean <optional>
false

Also convert the rgb values into hsv?

Returns
object -

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

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

Please login to continue.