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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEV is not able to undo LayersMergeAll...?!

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Aug 15 2016 : 10:00:55
Hello,

I am using following code to save a file and a thumbnail image:
ievMain.SaveToFileAll('Page001.afl', -1);

  ievMain.LayersCurrent := 0; // Select Background Layer

  ShowMessage('Total Layers: ' + IntToStr(ievMain.LayersCount));

  ievMain.Proc.SaveUndo();
  ievMain.LayersMergeAll();

  //Resize merge layer image to a smaller size
  ievMain.Proc.Resample(300, -1, TResampleFilter(rfBSpline));
  ievMain.IO.SaveToFileJpeg('Page001.jpg');

  //Restore the state of ImageEnVect to state before we merged all layers
  ievMain.Proc.Undo(False);

  ievMain.UnLockUpdate;
  ievMain.Update;
  ShowMessage('Total Layers: ' + IntToStr(ievMain.LayersCount));
  ievMain.MouseInteract := [miMoveLayers, miResizeLayers];

But somehow after merging all files and saving image in jpg ImageEnVect does not seem to be able to Undo the LayersMergeAll. Or am I making any mistake in my code?

Please guide me.

TIA


Yogi Yang
2   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Aug 16 2016 : 02:54:12
Hello Bill,

Thanks for the code sample. I will use it and get back to you if necessary.

TIA


Yogi Yang
w2m Posted - Aug 15 2016 : 11:46:06
Here is a good way to achieve what you are looking for to merge all layers and objects without actually merging. This eliminates the need to have to use undo to restore layers and objects after saving the file. The original layers and objects remain intact. This technique also allows printing or print preview without eliminating layers or objects.
procedure TForm1.SaveAll1Click(Sender: TObject);
var
  iImageEnView: TImageEnView;
begin
  iImageEnView := TImageEnView.Create(nil);
  try
    { Draw the layers to iImageEnView }
    ImageEnVect1.UnSelAllObjects;
    { Draw the layers and objects to iImageEnView }
    ImageEnVect1.LayersDrawTo(iImageEnView.IEBitmap);
    iImageEnView.Update;
    {Resample the iImageEnView}
    iImageEnView.Proc.Resample(300, -1, TResampleFilter(rfBSpline));
    { Save the image}
    iImageEnView.IO.SaveToFileJpeg('G:\Scrap\MergeAll.jpg');
  finally
    iImageEnView.Free;
  end;
end;

procedure TForm1.Print1Click(Sender: TObject);
var
  iImageEnView: TImageEnView;
begin
  iImageEnView := TImageEnView.Create(nil);
  try
    { Draw the layers and objects to iImageEnView }
    ImageEnVect1.LayersDrawTo(iImageEnView.IEBitmap);
    iImageEnView.Update;
    iImageEnView.IO.DoPrintPreviewDialog();
  finally
    iImageEnView.Free;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development