이미지가 보여질 캔버스의 가로크기릉 정해두고
갤러리에서 불러오는 이미지들이 캔버스의 가로 크기를 기준으로 이미지의 가로 세로 비율을 유지하도록 하고싶습니다.
지금 제가 생각한것은 다음과 같습니다.
1. 디스플레이 가로 세로 크기를 구한다.
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
mWidth = display.getWidth();
mHeight = display.getHeight();
2. 구한 디스플레이 가로를 이용하여 다음과 같이 bitmap이미지를 가로 크기를 정합니다.
mBitmap = Bitmap.createScaledBitmap(mBitmap, (int)mWidth * 8/10, (int)mHeight * 42/50, false);
3. 캔버스에 이미지를 넣습니다
canvas.drawBitmap(mBitmap, (mWidth * 1/5)/2, 0, null);
이 과정중에 어떤작업을 해주어야 하나요 ?