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
 Getting an undo into a TIEBitmap object
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

nwscomps

185 Posts

Posted - Aug 09 2011 :  16:35:52  Show Profile  Reply
Hello, is there any way to get an undo saved by imageEn into a TIEBitmap object without having to actually restore the undo in the imageenview component? What I want to do is to use a TIEBitmap from the Undo history as a feed for the ImageEnPaintEngine in order to emulate the photoshop history tool. If possible I should be able also to get the alpha channel of the undo.
Thanks for any answer.

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library

fab

1310 Posts

Posted - Aug 10 2011 :  00:23:18  Show Profile  Reply
Hello Francesco,
Undo/Redo is handled by TImageEnProc (not by TImageEnView that just embeds TImageEnProc), so you could attach a TImageEnProc to TIEBitmap, and use the Undo/Redo:

ImageEnProc.AttachedIEBitmap := yourBitmap;

Now you can call Undo/Redo and other related methods:

ImageEnProc.Undo();
Go to Top of Page

nwscomps

185 Posts

Posted - Aug 10 2011 :  05:32:19  Show Profile  Reply
Hi Fabrizio,
the problem is that I do not want to enable an undo history undo on a TIEBitmap, I just want to be able to retrieve the undo information from the history of a Timageenview (with embedded TImageenproc) and have it saved into a TIEBitmap. To explain better this is the scenario:
1) I have a Timageenview on a form with undo / redo capabilities enabled
2) Let's say I paint 5 times on the background layer
3) I want now to have access to the image stored in the undo at the position 2 in the history
4) I use this history image for my purposes (in my case a new painting)

So I am bound to the imageenview embedded imageenproc for the history. It is not useful to have a TIEBitmap with its own undo history in my case.

All what I look for is some method such as: Imageenview1.Proc.GetHistoryUndoAt(myPosition, myIEBitmap)

Also since the undo could be with alpha channel I would need the alpha channel as well. I hope it makes sense.



Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
Go to Top of Page

fab

1310 Posts

Posted - Aug 10 2011 :  06:08:36  Show Profile  Reply
There is only TImageEnProc.UndoAt, which allows to specify the saved image. Of course it replaces the currently attached TIEBitmap (and you can change it temporally to your new TIEBitmap destination).
Go to Top of Page

nwscomps

185 Posts

Posted - Aug 10 2011 :  10:33:49  Show Profile  Reply
Hi Fabrizio, thanks for the answer. So if I do the following it will be ok?

imageenview1.proc.attachedIEBitmap := mybitmap;
try
imageenview1.proc.undoat(2);
finally
imageenview1.proc.AttachedImageEn := imageenview1;
end;

Also how do I check if the current undo is of type image, vector, selection or other?

Thanks

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
Go to Top of Page

fab

1310 Posts

Posted - Aug 10 2011 :  14:44:33  Show Profile  Reply
No, you have to create a new TImageEnProc, and use only AttachedIEBitmap:

MyImageEnProc.AttachedIEBitmap := myBitmap;
MyImageEnProc.UndoAt(2);
MyImageEnProc.AttachedIEBitmap := ImageEnView1.IEBitmap;

And do not use ImageEnView.Proc.

>Also how do I check if the current undo is of type image, vector, selection or other?

Look at TImageEnProc.UndoPeekAt method.
Go to Top of Page

nwscomps

185 Posts

Posted - Aug 10 2011 :  15:43:56  Show Profile  Reply
I would expect that I can retrieve undo information from any undo history of any imageenproc, without necessarily having to undo / redo.
LEt's say I have an imageenview with selections and layers. Now I have moved layers and selections as well as applied different filters / corrections, every operation is registered in the imageenview's embedded imageenproc undo list, why can't I access this history and use its content? Why do I need to use a separate imageenproc? I guess the answer is this is the way it was developed, but this is the point maybe it is too restrictive?

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
Go to Top of Page

fab

1310 Posts

Posted - Aug 11 2011 :  01:33:13  Show Profile  Reply
>I would expect that I can retrieve undo information from any undo history of any
>imageenproc, without necessarily having to undo / redo.

This is exactly what UndoAt does (and AutoUndo is True).

>> Why do I need to use a separate imageenproc?

I don't know all your necessities (layers, etc...) and I proposed it to have clearer code. You can of course use also:

ImageEnView.Proc.AttachedIEBitmap := myBitmap;
ImageEnView.Proc.UndoAt(2);
ImageEnView.Proc.AttachedImageEn := ImageEnView;

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: