Jump to content

Can't seem to get getPixel() to work


lumoludo
 Share

Recommended Posts

Hey guys. I feel like I must be missing something really simple here, but I cannot get the bitmapData::getPixel() function to return anything other than a black color (0, 0, 0, 0).

I made an example here (you'll need to open the console to see what I'm talking about):
http://phaser.io/sandbox/nMqGYpij

I've also tried the getPixelRGB and getFirstPixel, but they both also only return 0, 0, 0, 0. The pixel I'm polling in the example is certainly not black though.

Any pointers you could give would be greatly appreciated.

Link to comment
Share on other sites

From the docs:

    /**
    * 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.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...