[cairo] Problems erasing a line.

Bill Spitzak spitzak at d2.com
Mon Mar 19 03:53:15 PDT 2007


Erasing the entire area and drawing all over again (your third solution) 
is the proper way to do it under Cairo.

The problem you are having is that antialiasing makes exact erasure of 
the previous line impossible because you are drawing a white line with 
transparent edges. You could probably erase the line by drawing a white 
rectangle of 1 pixel larger than the two line ends or a thicker white 
line. But you will quickly run into trouble if the background is not a 
plain white area, which is what would happen in any interesting real 
program.

Trying to do "incremenatal update" like you are doing is pretty much 
obsolete nowadays. The graphics i/o is way too fast to put up with the 
limits on what kinds of graphics that are drawn and the errors in 
display because of bugs due to unexpected combinations of updates. And 
on some hardware designs it is faster to draw from scratch, as 
retireving the old picture to draw onto it is slower than anything else.


More information about the cairo mailing list