Re: [Gimp-developer] how does undo currently work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Im desiging a small application, and I need some insipiration for an
undo system;its obvious that the GIMP's undo system, and the data it
operates on,  is far more complex than that of a text editor, so i was
curious about what it's approach was.

Thanks for the assitance. Im no under any deadline to do this project,
so my app won't be ready for months (its dinky anyway, so no need to be
excited about it).

On Thu, 2002-10-31 at 11:13, Sven Neumann wrote:
> Hi,
> 
> Hunter Peress <hu.peress@xxxxxxxxxxxxxx> writes:
> 
> > Could u explain what the meta information is based on? In order to
> > accomplish an undo, would this meta information be used to perform
> > the inverse of an operation?
> 
> for each action the GIMP undo systems stores all of the image data
> that is invalidated as well as other information about the action.
> These informations are then used to undo the action later. The exact
> type of data stored depends on the action that is pushed on the undo
> stack.
> 
> > A situation where I dont think the meta information would make sense
> > would be: when resizing an image (u lose pixels), so I think you
> > would have to keep the former image completely in memory and not
> > rely on meta information to bring it back (via a
> > computation/operation that is an inverse of the original) for the
> > undo.
> 
> I guess you are speaking of a crop operation here since an image
> resize doesn't alter any layer data. An image resize in The GIMP
> is a good example for an action that is represented solely by "meta
> data": 
> 
>   struct _ImageSizeUndo
>   {
>     gint width;
>     gint height;
>   };
> 
> This struct can be found in app/undo.c. Unfortunately this code sucks
> a lot, so take all necessary steps to protect yourself if you decide
> to take a look.
> 
> Assuming you meant to speak about cropping an image, or let's say a
> layer to simplify things a bit, you are basically right. GIMP needs to
> store the part of the layer that is cut away. It does so by pushing 
> the affected tiles to the undo stack together with the necessary info
> about how to restore them:
> 
>   struct _ImageUndo
>   {
>     TileManager  *tiles;
>     GimpDrawable *drawable;
>     gint          x1, y1, x2, y2;
>     gboolean      sparse;
>   };
> 
> > If the above is still not sinking in, it is simply my attempt to try
> > and understand in *further detail* (than your response below) how
> > the undo system works.
> 
> you still didn't tell us the reasons for your interest in the GIMP
> undo system. Of course you are free not to speak about it if you don't
> want to...
> 
> 
> Salut, Sven
> 



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux