我有以下代码...
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.test, options);
int[] pixels = new int[1];
if(b != null){
pixels = new int[b.getHeight()*b.getWidth()];
b.getPixels(pixels, 0, b.getWidth(), 0, 0, b.getWidth(), b.getHeight());
for(int i = 0 ; i < 100 ; i++){
Log.d("test","Pixel is :"+pixels[i]);
}
}
R.drawable.test 是 res/drawable-nodpi 目录中的 .bmp 文件
但我希望它看起来更像这样,而不是 0-255 值...
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.364: D/test(4088): Pixel is :-16777088
06-03 21:49:24.374: D/test(4088): Pixel is :-16777088
这个数字看起来根本不对,有人可以帮我解决我所缺少的吗?