"(in & 0xf) >> 2" what's the point of this? You are only keep the rightmost 4 bits if they are 1, then shifting them....?
-1 is fully opaque and fully white on the ARGB scale.....
It doesn't make much sense to me either.
It takes the first 4 least significant bits (rightmost) and then shifts them to the right by 2 bits (effectively erasing the first 2 bits) so that you end up with the third and fourth bits from the Blue color at the beginning of the int. The resulting data that is saved into the variable "col" will be '000000000000000000000000000000xx' where 'xx' is the third and fourth bits from the blue color. The following if statement "in == 0xffff00ff)" will always return false.
Because if he doesn't mask first, he'll shift in non-zero bits.
Actually, you always shift in bits of zero.
<< Signed left shift >> Signed right shift >>> Unsigned right shift
Just check the resulting pixel for the pink color. And if you've got Alpha enabled (most likely) make the pixel completely transparent (Set leftmost 8 bits to 0). Or if you're not using Alpha you need to omit drawing the specified pixel on the screen altogether.
int col = result.pixels[i];
if (col == Color.pink.getRGB()) col = 0; result.pixels[i] = col;
Some more random bit manipulation posts.http://www.java-gaming.org/topics/transparent-colors/26829/msg/238451/view.html#msg238451http://www.java-gaming.org/topics/tile-rendering/27088/msg/241432/view.html#msg241432