Moving Polygons

Hi

I have a problem with moving polygons. I'm drawing in an AWT canvas and when I click and drag a polygon it leaves a trace of where it has been. I'm only interrested in being able to see the current position, not where it has been only where it is. You can look at these screendumps to get an idea of what I'm talking about:

this is how it looks at first: http://www.m2i3d.dk/dev/forum_041201_1.JPG

this is how it looks when dragged: http://www.m2i3d.dk/dev/forum_041201_2.JPG

this is how it should look when done: http://www.m2i3d.dk/dev/forum_041201_3.JPG

hope you can be a help..

Sandpapir400

[643 byte] By [Sandpapir400] at [2007-9-30 23:30:35]
# 1

Possible solutions:

1) redraw the background when redrawing the polygon. Easy to implement, but may take some time to render if on a large area with lots of redraws. You'll need to include redrawing of previous polygons as well.

2) redraw just the area moved from and to. Similar to above approach, but takes a little more time to implment with the benefit of rendering faster.

3) use XOR mode when drawing movable polygon. Works if you are assured only one movable polygon at a time, but may create interesting colored polygons against some backgrounds. Switch back to paint mode to "finalize" a polygon.

jboeing at 2007-7-7 14:33:39 > top of Java-index,Security,Cryptography...