-
Color information:
Ok...
I need to know how to convert from 4 rgba values ( 0 - 255 ) to one single 32 bit integer.
I already have accuired the code for converting from the integer to rgba:
Code:
public static int [] int2rgba( int px )
{
int [] rgba = new int[4];
rgba[3] = ( px >> 24 ) & 0xff;
rgba[0] = ( px >> 16 ) & 0xff;
rgba[1] = ( px >> 8 ) & 0xff;
rgba[2] = px & 0xff;
return rgba;
}
i need to know how to change the rgba array back... anyone know?
-
Code:
public int rgba2int(int[] rgba) {
int ret = (rgba[3] << 24) |
(rgba[0] << 16) |
(rgba[1] << 8) |
rgba[2];
}
This will FAIL if any of the rgba members are > 255!
-