This입니다.
// Returns an immutable bitmap from the specified subset of the source bitmap.
static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height)
(0,0) 왼쪽 상단 또는 중앙 있다면 정말 모르겠지만, 나는 그것이 왼쪽 상단 믿습니다.
* (0,0)
*~~~~~~+===========+
' ' |
' ' 200 |
' ' |
+~~~~~~+ | 400
| 100 |
| |
| |
+==================+
300
이 참으로 그 센터의 경우는 왼쪽 상단이야 그렇지 않은 경우
x should be width /2
y >> height/2
: 두 차례에
x should be width /2 - cropWidth/2
y >> height/2 - cropHeight/2
이 같을 것이다.
* (150,200)
+==================+
| |
| +~~~~~~+ |
| ' ' |
| ' * '200 | 400
| ' ' |
| +~~~~~~+ |
| 100 |
+==================+
300
'newBitmap = Bitmap.createBitmap (oldBitmap, x, y, 500, 500);'과 같은 것이 있습니다. 보시다시피 x와 y가 누락되었습니다. 나는 그것을 계산하는 방법에 대해 잘 모르겠습니다. – Reinherd
@ SergiCastellsaguéMillán 내 대답을 한 번 더 읽습니다. –