GOOGLE对于图像的读取处理,已经封装了Bitmap类和BitmapFactory类,可以说囊括了许多种读取图片数据的方式,
但是如果我们通过图片解码得到纯RGB数据(byte[])和位图宽和高,又当如何将数据上屏显示呢?
查看SDK文档,其中 BitmapFactory.decodeByteArray(byte[] data, int offset, int length),不要鸡动,该byte[]针对的是完整的图片数据,包括文件头那些东东,所以不符要求
再看 Bitmap.createBitmap(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config) ,这个很接近了,我们要做的就是将byte[]data转化为int[]color
先看下效果图: