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
 Copy Selection of current layer to current layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

markus42

Germany
16 Posts

Posted - Jan 11 2013 :  01:55:06  Show Profile  Reply
Hello,

I try to copy the selection of the current layer into this layer (replace bitmap in this layer with selected area).

I am trying this part of code

// copy the selection to a bitmap 
ImageEnView.CopySelectionToBitmap(mybitmap);
//remove the selection? 
self.ImageEnView.DeSelect;
ImageEnView.CurrentLayer.Bitmap.Assign(mybitmap);
ImageEnView.Update;


But this is the wrong way, because no effect.

By the way, if i call this procedure for a second time i get an exception "EAccessViolation"

I'm looking forward someone has an hint for me.

Kind Regards

Markus





xequte

38613 Posts

Posted - Jan 11 2013 :  02:22:28  Show Profile  Reply
Hi Markus

How about if you use:

var
  idx: integer;

...

idx := ImageEnView1.LayersCurrent;
ImageEnView1.LayersCreateFromSelection;
ImageEnView1.LayersRemove(idx);
ImageEnView1.Update;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 11 2013 :  03:05:34  Show Profile  Reply
Hi Nigel,

thanks for your reply, this works nearly fine.
My code looks now like in the bottom.
After the insert i have to move the layer to the same index as before.

After the cut and past procedure the mouseinteraction is set to [miMoveLayers]. With a button, the user can select a region for "cut and paste" again (set mouseinteraction to [miSelect].
If i call the codefragement again, i get an "EAccessViolation".
Perhaps i have to remove the selected region with an other function (not imageEnView.Deselect), but i doesn't found it, sorry.



 idx := ImageEnView1.LayersCurrent;
  newidx := ImageEnView1.LayersCreateFromSelection;
  self.ImageEnView1.DeSelect;
  ImageEnView1.LayersRemove(idx);
  ImageEnView1.LayersMove(newidx-1,idx);
  ImageEnView1.Update;
  // set mouse interaction to move layers
  self.ImageEnView1.MouseInteract := [miMoveLayers];




Kind Regards

Markus
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 11 2013 :  05:48:31  Show Profile  Reply
Hello,

i changed now the logic of my cut paste.
for me it is good enough to crop the layerimage like this.

if ( imageenview1.Selected ) then
 begin

  ImageEnView1.Proc.CropSel;
  self.ImageEnView1.DeSelect;
  self.ImageEnView1.MouseInteract := [miMoveLayers];
  RefreshLayerViewer;

  exit;
 end
 else
 begin

   Exit;
 end;


Many Thanks

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