"(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.

<< Signedleftshift// Always shifts in 0's from the right.>> Signedrightshift// Shifts in copies of the MSB (left most bit) from the left.>>> Unsignedrightshift// Always shifts in 0's from the left.

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.

When you're using images with a palette based color format, then one color is dedicated to full transparency. It's sort of like green screen for sprites. By convention, it's pink (#FFFF00) to avoid conflicts with color is more likely to be included in the palette. It could also have been black, grey, white, bright green, etc. but that colors probably the least likely to appear in most sprites. GIMP and other image editors that can handle alpha channels show a background pattern instead of a solid background replacement color.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org