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
 Copy Selection of current layer to current layer

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
markus42 Posted - Jan 11 2013 : 01:55:06
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





3   L A T E S T    R E P L I E S    (Newest First)
markus42 Posted - Jan 11 2013 : 05:48:31
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
markus42 Posted - Jan 11 2013 : 03:05:34
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
xequte Posted - Jan 11 2013 : 02:22:28
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