title: Draw a transparent circle onto a filled android canvas
body: <p><img src="https://i.stack.imgur.com/cM8DL.png" alt="enter image description here"></p>
  
  <p>I am trying to do something very simple (see above). I want all of the pixels of a canvas to be a solid color, except for the the pixels that fill a centered circle. I have read hundreds stack overflow post on this subject and have tried hundreds of things including setting the PorterDuff.Mode. Here is my current onDraw() of MyView extends View:</p>
  
  <pre><code>  protected void onDraw(Canvas canvas) {
      int w = canvas.getWidth();
      int h = canvas.getHeight();
  
      Paint framePaint = new Paint();
      framePaint.setStyle(Paint.Style.FILL);
      framePaint.setColor(Color.BLUE);
      canvas.drawRect(0, 0, w, h, framePaint);
  
      Paint transparentPaint = new Paint();
      transparentPaint.setColor(Color.TRANSPARENT);
      transparentPaint.setAntiAlias(true);
      canvas.drawCircle(w / 2, h / 2, (w + h) / 4, transparentPaint);
    }
  </code></pre>
  
  <p>Am I misunderstanding something, why cant I paint over an existing pixel with transparent paint. When I do this the pixel stays the same. When I use PorterDuff, the pixel turns black. Please help.</p>