Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey
I had a problem with BitmapData.replaceColor, it worked sometimes and sometimes not.
I figured out that the problem was the different representation of the pixel data types.
The Uint32Array pixel[] value is compared to the return value of a packPixel() call.
Phaser.Color.packPixel(0,0,0,255) = -16777216
The same bits interpreted as uint32 are 4278190080.
The color comparisation will fail even if the color is the same.
This example does not work for me also:
http://examples.phaser.io/_site/view_full.html?d=display&f=bitmapdata+replace+color.js&t=bitmapdata%20replace%20color
I used this hack from stackoverflow to directly fix the packPixel() function.
http://stackoverflow.com/questions/22335853/hack-to-convert-javascript-number-to-uint32
The function Phaser.Color.toRGBA() still implements the "old" behaviour which can result in negative numbers.
Greetings
-- Phaiax