[Android] Bitmap crop with Rect
자르려면 필요한 값 자르려는 원본 이미지(bitmap) , 자를 영역의 정보 (좌표 및 크기) Rect(x,y,width,height)자를 영역의 시작 좌표 = x, y자를 영역의 너비,높이 = width, heightval rect = Rect(x, y, width, height)val cropBitmap = Bitmap.createBitmap(자르려는 원본 이미지, rect.left, rect.top, rect.width(), rect.height()) Rect 클래스의 주요 구성 요소좌표 (Coordinates):left: 사각형의 왼쪽 경계top: 사각형의 위쪽 경계right: 사각형의 오른쪽 경계bottom: 사각형의 아래쪽 경계
[kotlin] forEach(람다식)의 return break, continue처럼 사용하기
return 가장 가까운 enclosing function을 return 시킨다 val arr = arrayListOf("A","B","C","D","E","F","G") fun checkForEach() { arr.forEach { if(it == "D") return } println("찍힐까요 안 찍힐까요?") } 위의 예제를 실행하면 어떤 결과가 나타날까? 더보기 checkForEach()를 return 시키므로, println문이 찍히지 않는다 함수내의 lambda식을 return하고 싶다면? return@label 특정 label의 lambda식을 return 한다 val arr = arrayListOf("A","B","C","D","E","F","G") fun checkForEach() { ..