title: How to get total area covered while drawing path on canvas android?
body: <p>Im using below code to draw  line on bitmap canvas while finger touch move... here i posted partial code and it is working fine..</p>
  
  <p>As shown in below image, the black and white bitmap erased on touch drag.. I made canvas transparent so the parent layout background(color image) is getting visible.</p>
  
  <p>I want to know , how much area is erased(like 50% or 60% of bitmap ).. is there any way to find that?</p>
  
  <p><img src="https://i.stack.imgur.com/KZ3du.png" alt="enter image description here"></p>
  
  <pre><code>//Erasing paint
  
           mDrawPaint = new Paint();
      mDrawPaint.setAntiAlias(true); 
      mDrawPaint.setDither(true);  
      mDrawPaint.setStyle(Paint.Style.STROKE); 
      mDrawPaint.setStrokeJoin(Paint.Join.ROUND);
      mDrawPaint.setStrokeCap(Paint.Cap.ROUND);
      mDrawPaint.setStrokeWidth(50); 
      mDrawPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
      BlurMaskFilter mBlur = new BlurMaskFilter(10, BlurMaskFilter.Blur.NORMAL);
      mDrawPaint.setMaskFilter(mBlur);
  </code></pre>
  
  <hr>
  
  <pre><code>private void doDraw(Canvas c) {
  
      c.drawBitmap(mBitmap, 0, 0,null );
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>private float mX, mY;
  private static final float TOUCH_TOLERANCE = 1;
  
  void touch_start(float x, float y) {
      mPath.reset();
      mPath.moveTo(x, y);
      mX = x;
      mY = y;
  }
  void touch_move(float x, float y) {
      float dx = Math.abs(x - mX);
      float dy = Math.abs(y - mY);
      if (dx &gt;= TOUCH_TOLERANCE || dy &gt;= TOUCH_TOLERANCE) {
          mPath.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
          mX = x;
          mY = y;
      }
  
       canvas.drawPath(mPath, mDrawPaint ); //Erasing Black and white image
  
  }
  void touch_up() {
      mPath.lineTo(mX, mY);
      // commit the path to our offscreen
      mCanvas.drawPath(mPath, mDrawPaint);
      // kill this so we don't double draw
      mPath.reset();
  }
  </code></pre>