private void drawBackground(Canvas canvas) {

    RectF rect = mCropWindowHandler.getRect();

    float left = Math.max(BitmapUtils.getRectLeft(mBoundsPoints), 0);
    float top = Math.max(BitmapUtils.getRectTop(mBoundsPoints), 0);
    float right = Math.min(BitmapUtils.getRectRight(mBoundsPoints), getWidth());
    float bottom = Math.min(BitmapUtils.getRectBottom(mBoundsPoints), getHeight());

    if (mCropShape == CropImageView.CropShape.RECTANGLE) {
      if (!isNonStraightAngleRotated() || Build.VERSION.SDK_INT <= 17) {
        canvas.drawRect(left, top, right, rect.top, mBackgroundPaint);
        canvas.drawRect(left, rect.bottom, right, bottom, mBackgroundPaint);
        canvas.drawRect(left, rect.top, rect.left, rect.bottom, mBackgroundPaint);
        canvas.drawRect(rect.right, rect.top, right, rect.bottom, mBackgroundPaint);
      } else {
        mPath.reset();
        mPath.moveTo(mBoundsPoints[0], mBoundsPoints[1]);
        mPath.lineTo(mBoundsPoints[2], mBoundsPoints[3]);
        mPath.lineTo(mBoundsPoints[4], mBoundsPoints[5]);
        mPath.lineTo(mBoundsPoints[6], mBoundsPoints[7]);
        mPath.close();

        canvas.save();
        canvas.clipPath(mPath, Region.Op.INTERSECT);
        canvas.clipRect(rect, Region.Op.XOR);
        canvas.drawRect(left, top, right, bottom, mBackgroundPaint);
        canvas.restore();
      }
    } else {
      mPath.reset();
      if (Build.VERSION.SDK_INT >= 11
          && Build.VERSION.SDK_INT <= 17
          && mCropShape == CropImageView.CropShape.OVAL) {
        mDrawRect.set(rect.left + 2, rect.top + 2, rect.right - 2, rect.bottom - 2);
      } else {
        mDrawRect.set(rect.left, rect.top, rect.right, rect.bottom);
      }
      mPath.addOval(mDrawRect, Path.Direction.CW);
      canvas.save();
      canvas.clipPath(mPath, Region.Op.XOR);
      canvas.drawRect(left, top, right, bottom, mBackgroundPaint);
      canvas.restore();
    }
  }
Draw shadow background over the image not including the crop area.
core/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java