Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用像素和argb_Android - Fatal编程技术网

Android 使用像素和argb

Android 使用像素和argb,android,Android,当pixels=bitmap.getpixels(..)时,我有一个循环一直循环到I>24)和0xff);//阿尔法 argb+=(像素[x]&0xff);//蓝色 argb+=((像素[x]&0xff)您以错误的顺序移动。它应该是: int argb = 0; int alpha = ((pixels[x] >> 24) & 0xff); // alpha int blue = (pixels[x] & 0xff); // blue int gre

pixels=bitmap.getpixels(..)
时,我有一个循环一直循环到
I
。 现在我的循环中有以下代码:

int argb = 0;
argb += ((pixels[x] >> 24) & 0xff); // alpha 
argb += (pixels[x] & 0xff);         // blue
argb += ((pixels[x] & 0xff) << 8);  // green
argb += ((pixels[x] & 0xff) << 16); // red
pixels[x] = argb;
int argb=0;
argb+=((像素[x]>>24)和0xff);//阿尔法
argb+=(像素[x]&0xff);//蓝色

argb+=((像素[x]&0xff)您以错误的顺序移动。它应该是:

int argb = 0;
int alpha = ((pixels[x] >> 24) & 0xff); // alpha 
int blue = (pixels[x] & 0xff);         // blue
int green = ((pixels[x] >> 8 )& 0xff) ;  // green
int red = ((pixels[x] >> 16) & 0xff); // red
pixels[x] = alpha << 24 + red << 16 + green << 8 + blue
int argb=0;
int alpha=((像素[x]>>24)和0xff);//alpha
int blue=(像素[x]&0xff);//蓝色
绿色=((像素[x]>>8)和0xff);//绿色
int red=((像素[x]>>16)和0xff);//红色

像素[x]=alpha您希望得到什么结果?是什么使图像变粗?您的代码将红色、绿色和蓝色通道设置为蓝色通道的值(创建灰度图像),并将alpha通道的值(0-255)添加到此颜色。我想最后一部分不是您想要的。