/**
   * Gets the cropped image based on the current crop window.<br>
   * If image loaded from URI will use sample size to fir the requested width and height.
   *
   * @return a new Bitmap representing the cropped image
   */
  public Bitmap getCroppedImage(int reqWidth, int reqHeight) {
    if (mBitmap != null) {
      if (mLoadedImageUri != null && mLoadedSampleSize > 1) {
        Rect rect = getActualCropRectNoRotation();
        reqWidth = reqWidth > 0 ? reqWidth : rect.width();
        reqHeight = reqHeight > 0 ? reqHeight : rect.height();
        ImageViewUtil.DecodeBitmapResult result =
            ImageViewUtil.decodeSampledBitmapRegion(
                getContext(), mLoadedImageUri, rect, reqWidth, reqHeight);

        Bitmap bitmap = result.bitmap;
        if (mDegreesRotated > 0) {
          bitmap = ImageViewUtil.rotateBitmap(bitmap, mDegreesRotated);
        }

        return bitmap;
      } else {
        Rect rect = getActualCropRect();
        return Bitmap.createBitmap(mBitmap, rect.left, rect.top, rect.width(), rect.height());
      }
    } else {
      return null;
    }
  }