@SuppressLint("DrawAllocation")
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    final float radius =
        TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP,
            CORNER_RADIUS,
            mContext.getResources().getDisplayMetrics());

    RectF rectF =
        new RectF(
            Edge.LEFT.getCoordinate(),
            Edge.TOP.getCoordinate(),
            Edge.RIGHT.getCoordinate(),
            Edge.BOTTOM.getCoordinate());
    float cx = (Edge.LEFT.getCoordinate() + Edge.RIGHT.getCoordinate()) / 2;
    float cy = (Edge.TOP.getCoordinate() + Edge.BOTTOM.getCoordinate()) / 2;
    float radius2 = (Edge.RIGHT.getCoordinate() - Edge.LEFT.getCoordinate()) / 2;

    Path clipPath = new Path();
    clipPath.addCircle(cx, cy, radius2, Path.Direction.CW);
    canvas.clipPath(clipPath, Region.Op.DIFFERENCE);
    canvas.drawARGB(204, 41, 48, 63);
    canvas.restore();
    canvas.drawCircle(cx, cy, radius2, mBorderPaint);
    // drawRuleOfThirdsGuidelines(canvas);
  }
 public Rect getImageBounds() {
   return new Rect(
       (int) Edge.LEFT.getCoordinate(),
       (int) Edge.TOP.getCoordinate(),
       (int) Edge.RIGHT.getCoordinate(),
       (int) Edge.BOTTOM.getCoordinate());
 }
  private void drawRuleOfThirdsGuidelines(Canvas canvas) {

    final float left = Edge.LEFT.getCoordinate();
    final float top = Edge.TOP.getCoordinate();
    final float right = Edge.RIGHT.getCoordinate();
    final float bottom = Edge.BOTTOM.getCoordinate();

    // Draw vertical guidelines.
    final float oneThirdCropWidth = Edge.getWidth() / 3;

    final float x1 = left + oneThirdCropWidth;
    canvas.drawLine(x1, top, x1, bottom, mGuidelinePaint);
    final float x2 = right - oneThirdCropWidth;
    canvas.drawLine(x2, top, x2, bottom, mGuidelinePaint);

    // Draw horizontal guidelines.
    final float oneThirdCropHeight = Edge.getHeight() / 3;

    final float y1 = top + oneThirdCropHeight;
    canvas.drawLine(left, y1, right, y1, mGuidelinePaint);
    final float y2 = bottom - oneThirdCropHeight;
    canvas.drawLine(left, y2, right, y2, mGuidelinePaint);
  }