カメラ プレビューからバウンディング ボックス内の画像をトリミングし、アクティビティに表示しようとしています。その上にサーフェスビューと正方形のイメージビューがあります。imageview 内にのみ表示される画像をキャプチャする必要があります。以下は私のクロッピングコードです。ここで何が問題なのかわかりません。助けてください
int width = rotatedBitmap.getWidth();
int height = rotatedBitmap.getHeight();
int newWidth = (height > width) ? width : height;
int newHeight = (height > width)? height - ( height - width) : height;
int x = (width - height) / 2;
x = (x < 0)? 0: x;
int y = (height - width) / 2;
y = (y < 0)? 0: y;
Bitmap cropImg = Bitmap.createBitmap(rotatedBitmap, x, y,newWidth, newHeight);
私のコードの何が問題になっていますか?