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
 Interactive Crop Again
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Sep 22 2016 :  02:44:23  Show Profile  Reply
Hello,

How can we know if a user has pressed Enter/Return to apply interactive crop or not.

What I am trying to do is if the use has modified the crop area in interactive crop and not pressed Enter/Return to apply it I want to apply it programmatically.

How to do this?

TIA


Yogi Yang

xequte

38615 Posts

Posted - Sep 23 2016 :  11:45:52  Show Profile  Reply
The OnImageChange event will change when the user activates the crop:

http://www.imageen.com/help/TImageEnView.OnImageChange.html

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

yogiyang

India
727 Posts

Posted - Sep 26 2016 :  11:35:31  Show Profile  Reply
Hello Nigel,

Thank you for the tip. I will check it out.

But I feel that you should extend the OnLayerNotify to give info about crop. Just my 2 cents.

TIA


Yogi Yang
Go to Top of Page

xequte

38615 Posts

Posted - Sep 27 2016 :  12:14:32  Show Profile  Reply
Hi

I will investigate that...



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

John

USA
94 Posts

Posted - Sep 28 2016 :  12:30:26  Show Profile  Reply
Nigel

In a similar vein, it would be very useful to have an ImageEnView procedure that would allow displaying the crop box in a given location on the ImageEnView canvas via code after the ImageEnView.MouseInteract and various ImageEnView1.CropToolInteraction parameters were set. I have been unable to find such a procedure in ImageEnView and have tried unsuccessfully to accomplish this using the Key_Bd events with VK_Return or the Mouse_Event, see below.

procedure TformCrop.StartCropping(tempStatus: Boolean);
begin
  if tempStatus = True then
    begin
      ImageEnViewMiddle.MouseInteract := [ miCropTool ];
      ImageEnViewMiddle.Cursor := crIECrossSight;
      ImageEnViewMiddle.CropToolInteraction.LockAspectRatio := -1;
      ImageEnViewMiddle.CropToolInteraction.LockWidth := tempAbsWidth;
      ImageEnViewMiddle.CropToolInteraction.LockHeight := tempAbsHeight;

      SetCursorPos(ImageEnViewMiddle.XBmp2Scr(50), ImageEnViewMiddle.YBmp2Scr(50));
//      mouse_event(MOUSEEVENTF_LEFTDOWN, ImageEnViewMiddle.XBmp2Scr(50), ImageEnViewMiddle.YBmp2Scr(50), 0, 0);
      mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
      mouse_event(MOUSEEVENTF_MOVE, 50, 50, 0, 0);
      mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    end;
end;


Suggestions??

TIA

John
Go to Top of Page

xequte

38615 Posts

Posted - Sep 29 2016 :  03:26:47  Show Profile  Reply
Hi John

Does SetBitmapPolygon not work?

http://www.imageen.com/help/TIECropToolInteraction.SetBitmapPolygon.html

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

John

USA
94 Posts

Posted - Oct 06 2016 :  22:32:18  Show Profile  Reply
Nigel

The suggestion works great. The code below displays the crop box automatically in the center of an image utilized the saved (to ini or registry) last crop box size.

procedure TformCrop.SetCropBoxSize;
var
  tempCropBox_LeftEdge: Integer;
  tempCropBox_BottomEdge: Integer;
  ARect: TRect;     // left, top, right, bottom
begin
  with ImageEnViewMiddle do
    begin
      SetFocus;    // If missing the first click of the mouse on the image will remove the crop box
      MouseInteract := [miCropTool];
     
      tempCropBox_LeftEdge := Trunc( (ImageEnViewMiddle.IO.Params.Width - tempLastCropBox_Width) / 2);
      tempCropBox_BottomEdge := Trunc( (ImageEnViewMiddle.IO.Params.Height - tempLastCropBox_Height) / 2);

      CropToolInteraction.LockAspectRatio := -1;
      CropToolInteraction.LockWidth := tempLastCropBox_Width;
      CropToolInteraction.LockHeight := tempLastCropBox_Height;

      ARect := Rect( tempCropBox_LeftEdge, tempCropBox_BottomEdge + tempLastCropBox_Height,
                     tempCropBox_LeftEdge + tempLastCropBox_Width, tempCropBox_BottomEdge );
  
    ImageEnViewMiddle.CropToolInteraction.SetBitmapPolygon( ARect );
      ImageEnViewMiddle.Invalidate();
    end;
end;


Thanks for the reply

John
Go to Top of Page

xequte

38615 Posts

Posted - Oct 07 2016 :  10:46:04  Show Profile  Reply
Nice one.

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: