0
확대 후 ImageView의 높이 및 너비를 축소하는 방법 축소.확대 이미지 가져 오기 android의 비트 맵 높이 및 너비
나는 다음과 같은 코드를 사용하고 있습니다 :
mRectSrc.left = (int)(panX * bitmapWidth - viewWidth/(zoomX * 2));
mRectSrc.top = (int)(panY * bitmapHeight - viewHeight/(zoomY * 2));
mRectSrc.right = (int)(mRectSrc.left + viewWidth/zoomX);
mRectSrc.bottom = (int)(mRectSrc.top + viewHeight/zoomY);
mRectDst.left = getLeft();
mRectDst.top = getTop();
mRectDst.right = getRight();
mRectDst.bottom = getBottom();
// Adjust source rectangle so that it fits within the source image.
if (mRectSrc.left < 0) {
mRectDst.left += -mRectSrc.left * zoomX;
mRectSrc.left = 0;
}
if (mRectSrc.right > bitmapWidth) {
mRectDst.right -= (mRectSrc.right - bitmapWidth) * zoomX;
mRectSrc.right = bitmapWidth;
}
if (mRectSrc.top < 0) {
mRectDst.top += -mRectSrc.top * zoomY;
mRectSrc.top = 0;
}
if (mRectSrc.bottom > bitmapHeight) {
mRectDst.bottom -= (mRectSrc.bottom - bitmapHeight) * zoomY;
mRectSrc.bottom = bitmapHeight;
}
canvas.drawBitmap(mBitmap, mRectSrc, mRectDst, mPaint);
그래서이 코드는 내가 이미지 줌 효과를 얻고을 사용. 얼마나 비트 맵 높이 및 너비 확대 및 축소 후 가져올 수 있습니다.