oid toRgba(int color)
{
int rgb=new int[3];
int b = color & 0xff;
int g = (color >> 8) & 0xff;
int r = (color >> 16) & 0xff;
rgb[0]=r;
rgb[1]=g;
rgb[2]=b;
return rgb;
}
例:
红色:16711680 十进制
11111111 00000000 00000000 二进制
b = (11111111 00000000 00000000) & (00000000 00000000 11111111) = 0;
g = (00000000 11111111 00000000) & (00000000 00000000 11111111) = 0;
r =(00000000 00000000 11111111) & (00000000 00000000 11111111) = 11111111; (255)