question: @ Nullable public Bitmap cropImage ( ) { Bitmap viewBitmap = getViewBitmap ( ) ; if ( viewBitmap == null || viewBitmap . isRecycled ( ) ) { return null ; } cancelAllAnimations ( ) ; setImageToWrapCropBounds ( false ) ; RectF currentImageRect = RectUtils . trapToRect ( mCurrentImageCorners ) ; if ( currentImageRect . isEmpty ( ) ) { return null ; } float currentScale = getCurrentScale ( ) ; float currentAngle = getCurrentAngle ( ) ; if ( mMaxResultImageSizeX > 0 && mMaxResultImageSizeY > 0 ) { float cropWidth = mCropRect . width ( ) / currentScale ; float cropHeight = mCropRect . height ( ) / currentScale ; if ( cropWidth > mMaxResultImageSizeX || cropHeight > mMaxResultImageSizeY ) { float scaleX = mMaxResultImageSizeX / cropWidth ; float scaleY = mMaxResultImageSizeY / cropHeight ; float resizeScale = Math . min ( scaleX , scaleY ) ; Bitmap resizedBitmap = Bitmap . createScaledBitmap ( viewBitmap , ( int ) ( viewBitmap . getWidth ( ) * resizeScale ) , ( int ) ( viewBitmap . getHeight ( ) * resizeScale ) , false ) ; if ( viewBitmap != resizedBitmap ) { viewBitmap . recycle ( ) ; } viewBitmap = resizedBitmap ; currentScale /= resizeScale ; } } if ( currentAngle != 0 ) { mTempMatrix . reset ( ) ; mTempMatrix . setRotate ( currentAngle , viewBitmap . getWidth ( ) / 2 , viewBitmap . getHeight ( ) / 2 ) ; Bitmap rotatedBitmap = Bitmap . createBitmap ( viewBitmap , 0 , 0 , viewBitmap . getWidth ( ) , viewBitmap . getHeight ( ) , mTempMatrix , true ) ; if ( viewBitmap != rotatedBitmap ) { viewBitmap . recycle ( ) ; } viewBitmap = rotatedBitmap ; } int top = ( int ) ( ( mCropRect . top - currentImageRect . top ) / currentScale ) ; int left = ( int ) ( ( mCropRect . left - currentImageRect . left ) / currentScale ) ; int width = ( int ) ( mCropRect . width ( ) / currentScale ) ; int height = ( int ) ( mCropRect . height ( ) / currentScale ) ; return Bitmap . createBitmap ( viewBitmap , left , top , width , height ) ; }
target:  This method crops part of image that fills the crop bounds. <p/> First image is downscaled if max size was set and if resulting image is larger that max size. Then image is rotated accordingly. Finally new Bitmap object is created and returned.