Hunter Peress <[EMAIL PROTECTED]> 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

> 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

  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
Gimp-developer mailing list

Reply via email to