I take the red component of the color in this way:

int clr = needlePixels[i]; int red = (clr & 0x00ff0000) >> 16; 

Then I perform some actions on the bits of the red variable. How to write the modified color component back to the variable clr ?

    1 answer 1

     clr = (clr & 0xFF00FFFF) | (red << 16) 

    Like this (if not messed up). We reset the target bits and then set them from red.

    • Thank! Works. - exStas pm