📱 Android
[Android] Bitmap crop with Rect
콩드로이드
2024. 6. 13. 14:38
자르려면 필요한 값
자르려는 원본 이미지(bitmap) , 자를 영역의 정보 (좌표 및 크기)
Rect(x,y,width,height)
자를 영역의 시작 좌표 = x, y
자를 영역의 너비,높이 = width, height
val rect = Rect(x, y, width, height)
val cropBitmap = Bitmap.createBitmap(자르려는 원본 이미지, rect.left, rect.top, rect.width(), rect.height())
Rect 클래스의 주요 구성 요소
- 좌표 (Coordinates):
- left: 사각형의 왼쪽 경계
- top: 사각형의 위쪽 경계
- right: 사각형의 오른쪽 경계
- bottom: 사각형의 아래쪽 경계