(老了,但是...)您也可以使用 Java 代码交换字节顺序。我在这里写的访问位图字节的示例可能会有所帮助...
由于公众需求(以下未经测试 - 我仍然会看到那个神秘链接背后的内容) IE 以下未经测试:
public static Bitmap RGBA2ARGB(Bitmap img)
{
int width = img.getWidth();
int height = img.getHeight();
int[] pixelsIn = new int[height*width];
int[] pixelsOut = new int[height*width];
img.getPixels(pixelsIn,0,width,0,0,width,height);
int pixel=0;
int count=width*height;
while(count-->0){
int inVal = pixelsIn[pixel];
//Get and set the pixel channel values from/to int //TODO OPTIMIZE!
int r = (int)( (inVal & 0xff000000)>>24 );
int g = (int)( (inVal & 0x00ff0000)>>16 );
int b = (int)( (inVal & 0x0000ff00)>>8 );
int a = (int)( inVal & 0x000000ff) ;
pixelsOut[pixel] = (int)( a <<24 | r << 16 | g << 8 | b );
pixel++;
}
Bitmap out = Bitmap.createBitmap(pixelsOut,0,width,width,height, Bitmap.Config.ARGB_8888);
return out;
}