using the BitmapRegionDecoder when there is also a matrix

674 Views Asked by At

using the BitmapRegionDecoder to decode partial areas works fine in the general use.

however, i've come to a piece of code where i had to replace the creation of a bitmap by using a BitmapRegionDecoder , but here's the catch: the creation of the new bitmap used both a rectangle and a matrix, while i know for sure that the matrix was used only for translation and scaling.

how would i convert such a code to be used by BitmapRegionDecoder ?

for example, how do i convert this:

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);

into something that uses the BitmapRegionDecoder.decodeRegion ?

i've tried to use Matrix.mapRect , but i don't think it makes sense, as i've got weird results on the output bitmap compared to the original code.

0

There are 0 best solutions below