i have been using cleardevice() to clear the graphics … but it creates several problems
for eg .. i create a background but i have to clear some specific elements , then i have to use another user defined function drawb() which draws the background and simultaneously cleardevice();
creating a lot of problems
line(x,y,x1,y1); //suppose this line is to be erased
//but using cleardevice even clears the background
cleardevice();
drawb(); //to draw board or background
so i want to know an alternative approach(an approach to clear only the line not the background) (if it exists )
Once a line is drawn, there is no real way to remove it (except if you are drawing using XOR mode!). However, there are some thing you could do. You could render everything but the line in a page and store it there. Then, in another page you render everything, including the line. So if you want to undo the line, you just switch the page back.
An example:
Also, if you want to reset the screen with a background, there is no need to do a
cleardevice(), since thedrawb()overwrites every pixel ayway.