diff --git a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java index 51abac43..1a7c6401 100644 --- a/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java +++ b/cropper/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java @@ -618,7 +618,11 @@ private void drawBackground(Canvas canvas) { mPath.close(); canvas.save(); - canvas.clipPath(mPath, Region.Op.INTERSECT); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipOutPath(mPath); + } else { + canvas.clipPath(mPath, Region.Op.INTERSECT); + } canvas.clipRect(rect, Region.Op.XOR); canvas.drawRect(left, top, right, bottom, mBackgroundPaint); canvas.restore(); @@ -632,7 +636,11 @@ private void drawBackground(Canvas canvas) { } mPath.addOval(mDrawRect, Path.Direction.CW); canvas.save(); - canvas.clipPath(mPath, Region.Op.XOR); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipOutPath(mPath); + } else { + canvas.clipPath(mPath, Region.Op.INTERSECT); + } canvas.drawRect(left, top, right, bottom, mBackgroundPaint); canvas.restore(); }