I have an Imageview
which is zoomed and rotated(I have used multitouch zooming
). So how can i get bitmap of only visible content(I mean when i zoom the
If you know all the scale and rotation-values, you can create a Matrix with those values, and apply them to your bitmap via the Bitmap.createBitmap() method.
Example:
Bitmap original = ((BitmapDrawable) yourImageView.getDrawable()).getBitmap();
Matrix matrix = new Matrix();
matrix.setRotate(degrees);
matrix.postScale(scale, scale);
Bitmap result = Bitmap.createBitmap(original, 0, 0, original.getWidth(), original.getHeight(), matrix, true);
A faster, but maybe not as pretty solution is to create a bitmap and draw your currently visible view onto that:
Bitmap result = Bitmap.createBitmap(yourImageView.getWidth(), yourImageView.getHeight(), Bitmap.Config.RGB_565);
Canvas c = new Canvas(result);
yourImageView.draw(c);
After which result should contain exactly what you see on screen.