I set the predefined bitmap as the source of ImageView. Then I read the ImageView Matrix and changed the ImageView bitmap using matrix.postTranslate(shiftX, shiftY) .
Now I want to enlarge / reduce the image and save it while keeping the ImageView center at the same point in the bitmap that was before scaling.
If I try to enlarge the image using matrix.postScale(zoom, zoom) , specify what I want to save (blue dot), shift to another place (purple dot).
I tried several different ways to shift Bitmap back, but I cannot get it to work correctly. I know the initial size of the bitmap image, the size of the ImageView, the distances indicated by the outlined line. I tried to calculate the necessary shift and use matrix.postTranslate(-zoomshiftX, -zoomshiftY) afterwards, but it does not shift correctly.
It even turned out that the basic number of Bitmap pixels does not change after the matrix.postScale () function and checks matrix.postTranslate (-zoomshiftX / zoom, -zoomshiftY / zoom), but still no luck.
How to achieve such an increase?

wilkas
source share