ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Undo/Redo layers correct use when using own filters
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rmklever

Norway
57 Posts

Posted - Mar 13 2026 :  19:40:54  Show Profile  Reply
Hi,

I have some problems figuring out how to use the undo/redo functions when using my own filters together with layers.

When saving an undo action I use the following code:


  imgEdit.Proc.SaveUndo('FX:' + frmFX.FxUndoName, ieuFullLayer); //ieuImage
  imgEdit.Proc.ClearAllRedo;
  imgEdit.IEBitmap.Assign(frmFX.imgView.IEBitmap);


When I do undo filters disappear from image but if I do redo it is random if the filter show up again on the image...

Undo code is like this:

procedure TfrmMain.btnUndoClick(Sender: TObject);
begin
  imgEdit.Proc.Undo(True);
  CalcImgInfo;
  UpdateGUI;
  layMain.Update;
end;


Redo code is like this:

procedure TfrmMain.btnRedoClick(Sender: TObject);
begin
  imgEdit.Proc.Redo(True);
  CalcImgInfo;
  UpdateGUI;
  layMain.Update;
end;


How to do it to get correct behavior... I used ieuImage before but that gave even stranger results...



Roy M Klever
Klever on Delphi - www.rmklever.com

xequte

39364 Posts

Posted - Mar 15 2026 :  14:53:29  Show Profile  Reply
Hi Roy

I tested this using the following code:

procedure TForm1.Button5Click(Sender: TObject);
var
  bmp: TIEBitmap;
  i: Integer;
begin
  ImageEnView1.Proc.UndoLimit := 50;
  ImageEnView1.IO.LoadFromFile( 'D:\im.jpg' );

  for i := 1 to 9 do
  begin
    ImageEnView1.Proc.SaveUndo('undo ' + i.ToString, ieuImage );
    bmp := TIEBitmap.Create( 'D:\Testing_Multimedia\Numbers\' + i.ToString + '.png' );
    ImageEnView1.IEBitmap.Assign( bmp );
    ImageEnView1.Update();
    bmp.Free();
  end;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  ImageEnView1.Proc.Undo(True);
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
  ImageEnView1.Proc.Redo(True);
end;

It worked as expected, so something else must be going on. Are there multiple layers on the image? Does that affect it?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

rmklever

Norway
57 Posts

Posted - Mar 16 2026 :  12:24:58  Show Profile  Reply
Hi Nigel,

Yes everything works when using a single layer, but in my case I do have multiple layers. Auto undo/redo are set to true. After changing layer orders and adding multiple effects (my own applying to the layers IeBitmap) it starts to mix up the layers... and giving the undo/redo images in wrong order so something gets mixed up... I am using TImageEnLayerMView for administration of the layers

Roy M Klever
Klever on Delphi - www.rmklever.com
Go to Top of Page

xequte

39364 Posts

Posted - Mar 16 2026 :  17:27:23  Show Profile  Reply
Hi Roy

If you are adding or removing layers then you should be using ieuObjectsAndLayers which saves the complete state.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: