[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: undo/redo
From:       Matthias Elter <me () main-echo ! net>
Date:       1999-08-10 15:06:08
[Download RAW message or body]

Carsten Pfeiffer wrote:
> 
> On Mon, Aug 09, 1999 at 12:30:56PM +0200, Matthias Elter wrote:
> 
> Hi
> 
> > There are two different modifications:
> >
> > - Modifications of image data: We have to make snapshots of modified
> > areas per layer.
> > We should keep the last few snapshots in memory (let the user adjust the
> > max. memory that may be used for undo) and save older snapshots on disk.
> >
> > - Other modifications that do not effect the image data (zoom in/out,
> > ruler metric changes etc.): We just have to save the action that has
> > been done.
> 
> for the second type (like zooming), where only the view would be affected,
> I don't think undo/redo is necessary, as the operation is perfectly
> reversible. But maybe there could be a history-function for those
> operations.
> 
> We need a base "image operation" class; every filter, tool or whatever
> inherits that and has to implement/provide an apropriate undo-mechanism.
> 
> I talked about this a while ago with a friend (Florian Hacker), and that's
> what we came up with:
> 
> Every image operation creates an undo-object. The undo objects are stored
> in a list.
> There are different undo-implementations, a filter can subclass the base
> undo-class and provide an undo-class perfectly efficient for his purposes.
> E.g. one might only store the coordinates and values of pixels changed by
> the filter. Or even better, an undo-implementation for a
> "paint-rectangle-tool" can reduce the coordinates to 3 edge-coordinates.
> 
> Filter independent implementations:
> - the lazy one, just storing the whole previous image
> - diffing the original and filtered image and saving coordinates/values of
>   affected pixels
> 
> We can start with those and add better ones, later.
> 
> The Undo-class has two public methods, undo() and redo() (and maye load()
> and save(), so they can be stored within an image).
> 
> The user sees these undo objects as a history in a listbox, e.g.
> 
> +---------------+
> |New image      | (1st operation)
> |---------------|
> |Gaussion Blur  |
> |---------------|
> |Resize         |
> |---------------|
> |Selection      |
> |---------------|
> |Paint tool     | (last operation)
> |_______________|
> 
> Now he decides, that resizing was wrong, he just selects the Gaussion Blur
> state, and all the following actions are undone. The selection and paint
> tool actions are not immediately destroyed - he can redo them (both
> or only the the selection) as long as no further image manipulation is
> performed (then, the selection and paint undo-objects are deleted and
> removed from the list.
> 
> What do you think?

Sounds good. I recently tried Photoshop on a friends windows box and the
undo-history listbox rocks. :-)

-- 
Matthias Elter
me@kde.org / me@main-echo.net
KDE developer
Computer science student university of Wuerzburg, Germany

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic