BitmapData#getFirstPixel()

getFirstPixel(direction) → {object}

Scans the BitmapData, pixel by pixel, until it encounters a pixel that isn't transparent (i.e. has an alpha value > 0).
It then stops scanning and returns an object containing the color of the pixel in r, g and b properties and the location in the x and y properties.

The direction parameter controls from which direction it should start the scan:

0 = top to bottom
1 = bottom to top
2 = left to right
3 = right to left

Parameters
Name Type Argument Default Description
direction number <optional>
0

The direction in which to scan for the first pixel. 0 = top to bottom, 1 = bottom to top, 2 = left to right and 3 = right to left.

Returns
object -

Returns an object containing the color of the pixel in the r, g and b properties and the location in the x and y properties.

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

Please login to continue.