Painting mechanism re-implemented using bitmap