I'm using the touchimageview for zooming in my app. When I zoom an image it seems to be zooming into image that is scaled to fit the imagview rather than zooming into the images original size. Is there anyway to fix this?\
iv = new TouchImageView(c);
//Center the Image
iv.setScaleType(ScaleType.CENTER);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
params.weight = 1.0f;
params.gravity=Gravity.CENTER;
iv.setLayoutParams(params);
drawable = (AnimationDrawable)c.getResources().getDrawable(R.drawable.loading_animation);
UrlImageViewHelper.setUrlDrawable(iv, url,drawable);
Edit: I found this method in the touchimageview class but I'm not sure how to implement it to work with the default zooming effect...
/**
* Return a bitmap of the zoomed image. This method is different from getZoomedImage() because
* it cuts the image directly from the drawable source, and thus, is not limited by the resolution
* of the view. Not supported with FIT_XY.
* @return bitmap of zoomed image
*/
public Bitmap getZoomedImageFromSource() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedImageFromSource() not supported with FIT_XY");
}
Bitmap bitmap = ((BitmapDrawable) getDrawable()).getBitmap();
Rect r = getZoomedRect();
if (r.width() <= 0 || r.height() <= 0) {
return null;
}
return Bitmap.createBitmap(bitmap, r.left, r.top, r.width(), r.height());
}