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
 Layer Deform after Crop
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

markus42

Germany
16 Posts

Posted - Jan 22 2013 :  04:32:13  Show Profile  Reply
Hello,

i am using this code for crop a layer (selection has been set before)
ImageEnView.Proc.CropSel;


Then i get the layer with only the croped part of the image.

If the layer has been resized with the mouse before set the selection and crop the image, the result is defomed, this means the croped new content doesn't look like expected. It is much more growing wider.

I hope someone can help me. I try to explain it in the attached jpg file.

Kind Regards





markus42

Germany
16 Posts

Posted - Jan 22 2013 :  07:09:53  Show Profile  Reply
I have now this "solution".
Before "crop" the image i am save the dimension of the selection rectangle. I set this new with and heiht as the new dimension of the layer.

I think this is not a good solution, but better than the deformation.
Other tips are welcome.

Kind Regards.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 22 2013 :  08:09:59  Show Profile  Reply
Maybe setting the layer dimensions to the bitmap dimensions after cropping will work for you:
procedure TForm1.Crop1Click(Sender: TObject);
begin
  ImageEnView1.Proc.SaveUndo();
  Undo1.Enabled := ImageEnView1.Proc.CanUndo;
  ImageEnView1.Proc.CropSel;
  ImageEnView1.DeSelect;
  ImageEnView1.Layers[ImageEnView1.LayersCurrent].Width := ImageEnView1.Bitmap.Width;
  ImageEnView1.Layers[ImageEnView1.LayersCurrent].Height := ImageEnView1.Bitmap.Height;
  ImageEnView1.Update;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: