How to completely erase a rectangle drawn using drawRect(x, y, w, h) ?

Saptadeep Dutta

For erasing the rectangle add 1 to both width and height.
For example If the rectangle was drawn as drawRect(x, y, w, h), then to clear this rectangle use clearRect(x, y, w+1, h+1). Both drawRect() and clearRect() used with proper logic of 'events' can give the impresion of an animated rectangular box resize.