RSS/Atom feed Twitter
Site is read-only, email is disabled

how does undo currently work

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

9 of 10 messages available
Toggle history

Please log in to manage your subscriptions.

how does undo currently work Hunter Peress 31 Oct 05:58
  how does undo currently work Sven Neumann 31 Oct 10:20
   how does undo currently work Hunter Peress 31 Oct 15:52
    how does undo currently work Sven Neumann 31 Oct 15:59
     how does undo currently work Hunter Peress 31 Oct 17:37
      how does undo currently work Sven Neumann 31 Oct 18:13
       how does undo currently work Hunter Peress 31 Oct 18:42
DE924A789E3C124F8C8A319F273... 07 Oct 20:21
  how does undo currently work Austin Donnelly 01 Nov 10:54
   how does undo currently work Sven Neumann 01 Nov 11:17
Hunter Peress
2002-10-31 05:58:06 UTC (over 21 years ago)

how does undo currently work

Suppose 100 actions are done to an image of size T Would gimp's memory increase by 100T ?

Or is there some intelligence done for the undoing?

Sven Neumann
2002-10-31 10:20:37 UTC (over 21 years ago)

how does undo currently work

Hi,

Hunter Peress writes:

Suppose 100 actions are done to an image of size T Would gimp's memory increase by 100T ?

it depends on what you are undoing. Only the altered tiles and the necessary meta information to undo the action is stored in the undo system.

Salut, Sven

Hunter Peress
2002-10-31 15:52:36 UTC (over 21 years ago)

how does undo currently work

So whats the approach for this meta information? Will u ever use this meta information to perform the inverse of an operation?

When resizing an image u lose pixels, so you would have to store size T in memory. No meta information there really.

On Thu, 2002-10-31 at 03:20, Sven Neumann wrote:

Hi,

Hunter Peress writes:

Suppose 100 actions are done to an image of size T Would gimp's memory increase by 100T ?

it depends on what you are undoing. Only the altered tiles and the necessary meta information to undo the action is stored in the undo system.

Salut, Sven

Sven Neumann
2002-10-31 15:59:52 UTC (over 21 years ago)

how does undo currently work

Hi,

Hunter Peress writes:

So whats the approach for this meta information? Will u ever use this meta information to perform the inverse of an operation?

yes. What do you think we save it for?

When resizing an image u lose pixels, so you would have to store size T in memory. No meta information there really.

did I say something else?

You could help all of us by explaining the reason of your question and by trying to be a little more verbose. I'm not sure if I understood your mail at all.

Salut, Sven

Hunter Peress
2002-10-31 17:37:06 UTC (over 21 years ago)

how does undo currently work

I'll try to clarify for you.

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?

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.

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.

On Thu, 2002-10-31 at 03:20, Sven Neumann wrote:

Hi,

Hunter Peress writes:

Suppose 100 actions are done to an image of size T Would gimp's memory increase by 100T ?

it depends on what you are undoing. Only the altered tiles and the necessary meta information to undo the action is stored in the undo system.

Salut, Sven

Sven Neumann
2002-10-31 18:13:19 UTC (over 21 years ago)

how does undo currently work

Hi,

Hunter Peress 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

Hunter Peress
2002-10-31 18:42:57 UTC (over 21 years ago)

how does undo currently work

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 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

Austin Donnelly
2002-11-01 10:54:55 UTC (over 21 years ago)

how does undo currently work

I wrote some docs about the undo system's operation; try looking around in the doc/ subdirectory.

I can't vouch for how accurate they are now, but I don't think the system has changed much since I added the "undo history" feature.

Austin

Sven Neumann
2002-11-01 11:17:49 UTC (over 21 years ago)

how does undo currently work

Hi,

"Austin Donnelly" writes:

I wrote some docs about the undo system's operation; try looking around in the doc/ subdirectory.

I can't vouch for how accurate they are now, but I don't think the system has changed much since I added the "undo history" feature.

no, it hasn't.

Just for the record, the plan for GIMP-1.4 is to clean it up a little more and implement the undo steps as objects derived from GimpViewable. This will significantly reduce the code needed for the undo history dialog but it won't change how the undo system works in prinicple.

Salut, Sven