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
 Cropping region outside of image

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
BillM Posted - Dec 04 2017 : 01:44:41
How do we prevent the cropping rectangle from being drawn or moved past the edges of the photo? Am I missing a setting somewhere that does this automatically?
4   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 04 2017 : 15:27:50
Hi

In the next update, you can use:

ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options + [iecoLimitToBounds];

You can email us for a pre-release.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
w2m Posted - Dec 04 2017 : 13:47:17
You can use a selection to crop instead of the crop tool and control its visibility in OnMouseMove to give you what you are looking for. Then just crop if there is a selection. This is relatively easy to accomplish.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
BillM Posted - Dec 04 2017 : 12:59:09
Hmmm, then is there a way to determine if the cropping rectangle is within the boundaries of the image. Let's say that I draw but them move it and the left edge extends past the left edge of the image.

If I could determine that the four edges of cropping rectangle are within the bounds of the image, then I would allow the crop to take place, otherwise I could prevent it.
w2m Posted - Dec 04 2017 : 11:13:34
I do not use the croptool very much but as far as I can tell the crop tool does not have an option for this. The best that I could come up with, is to cancel the tool if its coordinates are not over the IEBitmap.
If the tool is not within the IEBitmap with this code you have to reselect to make it visible again. Perhaps Nigel may fix this problem.
procedure TForm1.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  iX: integer;
  iY: integer;
begin
  iX := ImageEnView1.XScr2Bmp(X);
  iY := ImageEnView1.YScr2Bmp(Y);
  if ((iX <= 0) or (iX > ImageEnView1.IEBitmap.Width)) then
  begin
    ImageEnView1.CropToolInteraction.Cancel();
    ImageEnView1.Deselect;
  end
  else if ((iY <= 0) or (iY > ImageEnView1.IEBitmap.Height)) then
  begin
    ImageEnView1.CropToolInteraction.Cancel();
    ImageEnView1.Deselect;
  end
  else
    ImageEnView1.MouseInteract := [miCropTool];
end;

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