Reputation: 1603
I am trying to implement pinch zoom and it is working but when i zoom out and then zoom in again the resolution of the image(bitmap) decreases. I am aware that this is just normal behavior of my code and i want to know how to do this with right way .
here is the relevant code :
Matrix matrix = new Matrix() ;
float scale = newDist / oldDist;
matrix.postScale(scale, scale, mid.x, mid.y);
int width = mutable.getWidth() ;
int height = mutable.getHeight() ;
mutable = Bitmap.createBitmap(mutable, 0, 0, width, height, matrix, false);
Upvotes: 2
Views: 7022
Reputation: 708
There is a tutorial here:
http://blogs.sonyericsson.com/wp/2010/05/18/android-one-finger-zoom-tutorial-part-1/
Upvotes: 2
Reputation: 27411
Keep the original bitmap unchanged. Everytime you resize you work on a clone of that original.
Upvotes: 6