aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Erasing Scribbles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Erasing Scribbles" Watch "Erasing Scribbles" New topic
Author

Erasing Scribbles

Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
So let's say I have a Java application that allows for the drawing of scribbles. However, the way I store the scribbles in memory is by turning the scribble into line segments and storing the two points of each line segment (thereby not actually storing every single pixel coordinate into memory).
Now, I have to be able to erase that scribble...does anyone have any fancy ideas on how this can be done within Java that is efficient. I've thought about turning the scribble back into it's pixel-by-pixel form and working from there, but it seems like the refreshing and redrawing of it is pretty inefficient and quite flickery.
I'm open to suggestions from those that might have a much better idea on this than I do.
Thanks!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10255
    
    8

I see two approaches to this

1) Remove the line segment(s) which were "erased"
2) If the user is provided an "eraser" whenever he updates the canvas (draw/erase) etc, update the line segments


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Erasing Scribbles