title: How to delete shapes drawn on an Image
body: <p>I am developing a small Paint tool. And I am able to load and draw Lines or Circles and other shapes on an image. Also I have an eraser tool to erase the shapes that I have drawn.<br>
  This is code for that:  </p>
  
  <pre><code>g.setColor(getColor().WHITE);
  g.fillRect(getXAxis() - getThickness(), getYAxis() - getThickness(), getThickness() * 2, getThickness() * 2);
  </code></pre>
  
  <p>My problem is that, If I have loaded an image and drawn some shapes on it. Then when I tried to erase the shapes, the image is also gets replaced with white color.<br>
  Is there any way to set the image as the background while using <code>fillRect()</code> to erase the shape, so that my image will be untouched.</p>