1.获取BitmapDrawable对象(通过Bitmap对象)
BItmapDrawable drawable = new BitmapDrawable(bitmap);
2.通过BiemapDrawable获取Bitmap对象
Bitmap bitmap = drawable.getBitmap();
3.Bitmap的一些静态方法
1>creatBitMap(Bitmap source , int x ,int y,int width, int height);
从位图source的制定坐标点(给定的X,Y)开始,从中"挖取"宽width,高height的一块出来,创建新的BItmap对象.
2>creatScaledBitmap(Bitmap src ,int dstWidth ,int dstHeight , boolean filter);
对于原位图src进行缩放,缩放成宽dstWidth,高dstHeight的新位图.
3>creatBitmap(int width, int height ,Bitmap.Config config)
创建一个宽width,和高height的新位图.
4>createBitmap(Bitmap source ,int x ,int y ,int width ,int height ,Matrix m ,boolean filter);
从位图source的制定坐标点(给定的X,Y)开始,从中"挖取"宽width,高height的一块出来,创建新的BItmap对象,并按照Matrix(矩阵,不会的可以百度一下)指定的规律进行变化.
4.BitmapFactory的常用方法
1>decodeByteArray(byte[] data , int offset ,int length);
从指定字节数组的offset位置开始将长度为length的字节数据解析成Bitmap对象.
2>decodeFile(String pathName);
从pathName指定的文件中解析,创建Bitmap对象
3>decodeFileDescriptor(FileDescriptor fd);
用于从FileDescriptor对应的文件中解析,创建Bitmap对象(文件描述符的主要实际用途是创建一个包含该结构的 FileInputStream 或 FileOutputStream);
4>decodeResource(Resource res ,int id);
用于根据给定的资源ID从指定资源中解析,创建Bitmap对象.
5>decodeStream(InputStream is);
用于指定输入流中解析创建Bitmap对象.
5.android为Bitmap提供两个方法判断他是否已经回收,以及强制Bitmap回收自己;
1>boolean isRecycled();
返回该bitmap对象是否被回收
2>void recycle();
强制一个BItmap对象立即回收自己.