Android 当还有矩阵时使用BitMapRegionCoder

Android 当还有矩阵时使用BitMapRegionCoder,android,matrix,bitmap,rectangles,bitmapregiondecoder,Android,Matrix,Bitmap,Rectangles,Bitmapregiondecoder,使用BitMapRegionCoder对部分区域进行解码在一般使用中效果良好 然而,我遇到了一段代码,其中我必须使用BitMapRegionCoder替换位图的创建,但这里有一个陷阱:新位图的创建同时使用了矩形和矩阵,而我确信矩阵仅用于平移和缩放 如何将这样的代码转换为BitMapRegionCoder使用 例如,如何将其转换为: Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),R.drawable.android);

使用BitMapRegionCoder对部分区域进行解码在一般使用中效果良好

然而,我遇到了一段代码,其中我必须使用BitMapRegionCoder替换位图的创建,但这里有一个陷阱:新位图的创建同时使用了矩形和矩阵,而我确信矩阵仅用于平移和缩放

如何将这样的代码转换为BitMapRegionCoder使用

例如,如何将其转换为:

Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),R.drawable.android);
Matrix matrix = new Matrix();
//<=mess around with the matrix, but only translations and scaling.
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,width, height, matrix, true);
Bitmap-bitmapOrg=BitmapFactory.decodeResource(getResources(),R.drawable.android);
矩阵=新矩阵();

//我认为你可以使用
mapRect
只进行翻译,缩放rect只会加载源位图的不同大小的区域,而不会缩放位图。你明白了吗?我没有。那是很久以前的事了。