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) )
发布于 2017-10-27 18:20:11
public static int getARBGInt(int a, int r, int g, int b) {
return (a << 24) + (r << 16) + (g << 8) + b;
}我不小心把“| 0xFF”放在了<< ...的结果上
https://stackoverflow.com/questions/46972337
复制相似问题