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
 Create rectangle with fixed size and with centre in the mouse click location
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

MartinR

Czech Republic
3 Posts

Posted - Apr 07 2024 :  15:59:24  Show Profile  Reply
Hello,
I have to use this excellent library for a simple app to label parts of images.

There are some basic requirements. When the user clicks the mouse, a rectangle (vector) should be created with its centre exactly at the point of the click. Is it possible to do this by just adjusting some parameters or do I have to manually add or draw the rectangle object on the background image within the code's onMouseClick event?

Thank you very much for the hint and the help.

Best regards
Martin

xequte

38610 Posts

Posted - Apr 07 2024 :  19:41:39  Show Profile  Reply
Hi Martin

You have two main options:

1. Add a rectangular shape layer object:

http://www.imageen.com/help/TIEShapeLayer.html

You can either add this automatically (click and drag) using mlCreateShapeLayers:

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

Or manually in a mouse event using LayersAdd();

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

Of course, you would need to merge (burn it) with the image when you are done:

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


2. Draw directly to the bitmap's TIECanvas, e.g.

http://www.imageen.com/help/TIECanvas.Rectangle.html
http://www.imageen.com/help/TIECanvas.AdvancedDrawShape.html

Ensure you call ImageEnView1.Update() to display the canvas changes in the viewer.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: