LEADTOOLS Support
General
LEADTOOLS SDK Examples
HowTo implement a Undo/Redo feature using a RasterImageViewer + ImageOperations?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, December 29, 2009 7:40:39 AM(UTC)
Groups: Registered
Posts: 7
#2
Posted
:
Tuesday, December 29, 2009 8:01:10 AM(UTC)
Groups: Registered
Posts: 7
By image operation I mean: Crop, resize, rotate etc.
[:)]
#3
Posted
:
Tuesday, December 29, 2009 10:39:25 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello,
There really isn't necessarily one distinct way to set this functionality up. It could vary from application to application exactly how it is implemented.
How many "undo" operations are you going to allow? Are you going to allow multiple redos?
If you're looking for a simple one step undo/redo system, you could simply save the current image to memory prior to processing it. If the user requests undo-ing the previous step, save the current image, and load the previous save. If they request a re-do, then load the current image that was saved. In short, keep a temp save, and swap them as necessary.
If you're looking to possible incorporate something more complex, the implementation will likely require at least one copy of the image, and a list of type Leadtools.ImageProcessing.RasterCommand. For "undo-ing" an operation, you could either simply save a copy of an image before running an command on it, and revert back to this upon request, or you could use the list of IRasterCommands you have to re-process the image from when it was loaded.
Depending on the number of commands that could take place, you may want to implement a system of temporary files, whereby every so often you'll save a file to revert back to if the user has to revert back many steps.
Regarding loading/saving, please refer to the .NET help file for use of one of the overloads for RasterCodecs.Load and RasterCodecs.Save. You could save to a memory stream or to the hard disk, depending on what type of implementation you want.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#4
Posted
:
Tuesday, December 29, 2009 10:49:11 AM(UTC)
Groups: Registered
Posts: 7
I wish to have an infinite amount of undo/redo.
I am trying to save copies, but I'm having problems in undoing/redoing adding and removing pages.
=(
#5
Posted
:
Wednesday, December 30, 2009 12:53:15 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
David,
I have posted a simple C# application that illustrates this concept here:
http://support.leadtools.com/SupportPortal/CS/forums/32265/ShowPost.aspx
The implementation uses two stacks instead of lists, as these seemed more appropriate.
If you have any questions or concerns regarding this, please let me know. Please explain in as much exactly any problems you're having so I can better assist you.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
General
LEADTOOLS SDK Examples
HowTo implement a Undo/Redo feature using a RasterImageViewer + ImageOperations?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.