public static int[] getIntARGB(int argb){
int result[] = new int[4];
result[0] = (argb & 0xff000000) >> 24;
result[1] = (argb & 0x00FF0000) >> 16;
result[2] = (argb & 0x0000FF00) >> 8;
result[3] = (argb & 0x000000FF);
return result;
}
public static int getARBGInt(int a, int r, int g, int b) {
return ((a << 24) | 0xFF) + ((r << 16) | 0xFF) + ((g << 8) | 0xFF) + (b | 0xFF);
}
你知道为什么我拿一个argb int然后分解它并放置它,它不会返回相同的值吗?
这两个(或两个)函数中的一个在某种程度上搞砸了,但我不知道为什么(当然,如果以前分解并重新组合我想要修改的相同argb值将是愚蠢但是如果有的话是一个问题,我不能工作x))
答案 0 :(得分:1)
public static int getARBGInt(int a, int r, int g, int b) {
return (a << 24) + (r << 16) + (g << 8) + b;
}
我已经意外地把#34; | 0xFF&#34;关于<< ...