色彩合成:

1
2
//设alpha,red,green,blue都是0~255之间的数
color32 = alpha << 24 | red << 16 | green << 8 | blue;

色彩提取:

1
2
3
4
alpha = color32 >> 24;
red = color32 >> 16 & 0xFF;
green = color32 >> 8 & 0xFF;
blue = color32 & 0xFF;