private static Bitmap cropBitmapObjectWithScale(
      Bitmap bitmap,
      float[] points,
      int degreesRotated,
      boolean fixAspectRatio,
      int aspectRatioX,
      int aspectRatioY,
      float scale,
      boolean flipHorizontally,
      boolean flipVertically) {

    // get the rectangle in original image that contains the required cropped area (larger for non
    // rectangular crop)
    Rect rect =
        getRectFromPoints(
            points,
            bitmap.getWidth(),
            bitmap.getHeight(),
            fixAspectRatio,
            aspectRatioX,
            aspectRatioY);

    // crop and rotate the cropped image in one operation
    Matrix matrix = new Matrix();
    matrix.setRotate(degreesRotated, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
    matrix.postScale(flipHorizontally ? -scale : scale, flipVertically ? -scale : scale);
    Bitmap result =
        Bitmap.createBitmap(bitmap, rect.left, rect.top, rect.width(), rect.height(), matrix, true);

    if (result == bitmap) {
      // corner case when all bitmap is selected, no worth optimizing for it
      result = bitmap.copy(bitmap.getConfig(), false);
    }

    // rotating by 0, 90, 180 or 270 degrees doesn't require extra cropping
    if (degreesRotated % 90 != 0) {

      // extra crop because non rectangular crop cannot be done directly on the image without
      // rotating first
      result =
          cropForRotatedImage(
              result, points, rect, degreesRotated, fixAspectRatio, aspectRatioX, aspectRatioY);
    }

    return result;
  }
Crop image bitmap from given bitmap using the given points in the original bitmap and the given
rotation.<br>
if the rotation is not 0,90,180 or 270 degrees then we must first crop a larger area of the
image that contains the requires rectangle, rotate and then crop again a sub rectangle.

@param scale how much to scale the cropped image part, use 0.5 to lower the image by half (OOM
    handling)
core/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java