The dc.clear() doc says:
Erase the screen using the background color.
Note:
Starting form version 3.1.0, COLOR_TRANSPARENT will also be honored as background color, which will cause the value of pixels in the clip region to be replaced...