표면 뷰에서 비트 맵의 크기를 천천히 (비트 맵 에서처럼) 크기를 조정하고 싶습니다. 내가 너비와 높이에 대한 몇 가지 표준 증가 값을 설정하면, 디스플레이는 더 큰 image.As 내가 된 onDraw 방법안드로이드의 표면 뷰에서 비트 맵 확대하기
can.drawBitmap(gball, lastVisitedX, lastVisitedY, paint);
gball = getResizedBitmap(gball, bitmapInitHeight
+ bitmapInitHeight, bitmapInitHeight + bitmapInitHeight);
public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) {
int width = bm.getWidth();
int height = bm.getHeight();
float scaleWidth = ((float) newWidth)/width;
float scaleHeight = ((float) newHeight)/height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height,
matrix, false);
return resizedBitmap;
}
아래 줄 그러나 것 나는
can.drawBitmap(gball, lastVisitedX, lastVisitedY, paint);
gball = getResizedBitmap(gball, bitmapInitHeight
+ zoomXValue, bitmapInitHeight + zoomYValue);
zoomXValue= zoomXValue+5;
zoomYValue= zoomYValue+5;
같은 높이와 폭을 증가시켜 크기를 조정하려고 할 때
onDraw 메서드에서 비트 맵의 크기가 나쁜 품질로 조정됩니다.
마지막으로 제 질문은 품질을 손상시키지 않고 확대 축소하는 방법입니다.
미리 감사드립니다.
이미지를 확대/축소하려면 다음 라이브러리를 제안하십시오. https://github.com/sephiroth74/ImageViewZoom – Jarvis