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
 Copying imageenvect
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pierrotsc

USA
497 Posts

Posted - Aug 28 2014 :  19:05:39  Show Profile  Reply
in my quest to create channels you can edit with multiple layers, i need to find a way to copy an imageenvect with multiple layers to another one. what is the most efficient way?
i tried the assign function but it looks like it copies only the current layer.
i wrote frm_buffer.imageenvect.assign(imageenvect)

thanks
Pierre

w2m

USA
1990 Posts

Posted - Aug 29 2014 :  11:57:18  Show Profile  Reply
procedure TForm1.CopyLayersAndObjects1Click(Sender: TObject);
{ Copy ImageEnVect1 layers and objects To ImageEnVect2 }
var
  iMemoryStream: TMemoryStream;
begin
  iMemoryStream := TMemoryStream.Create;
  try
    ImageEnVect1.LayersSaveToStream(iMemoryStream);
    iMemoryStream.Position := 0;
    { Copy all layers from ImageenVect1 to ImageEnVect2. This maintains the alpha channel }
    ImageEnVect2.LayersLoadFromStream(iMemoryStream);
    { Copy all objects from ImageEnVect1 to ImageEnVect2 }
    ImageEnVect1.CopyAllObjectsTo(ImageEnVect2);
    ImageEnVect2.Update;
  finally
    iMemoryStream.Free;
  end;
end;

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

pierrotsc

USA
497 Posts

Posted - Aug 29 2014 :  12:12:15  Show Profile  Reply
Thanks. By adding that to the on image change event, I get a stream error. I sent you an email with the screenshot.
Sincerely,
Pierre
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 29 2014 :  12:24:48  Show Profile  Reply
I added it to a demo app here and it does not cause an exception. Anyway, I do not think that is a good to copy layers and objects to another TImageEnVect in the ImageEnVect1ImageChange because the event is not executed when you add layers or objects. I would put the code in the code after you add a layer and after you add objects.

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

xequte

38616 Posts

Posted - Aug 31 2014 :  22:47:19  Show Profile  Reply
Note, in v5.1.2. you can TImageEnView.Assign will copy all layers and vect objects. Email me if you want the source changes.

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