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
 Polygon Selection with TImageEnView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

HMArnold

USA
33 Posts

Posted - Sep 30 2025 :  20:57:15  Show Profile  Reply
I'm trying to learn how to select and deselect polygons using TImageEnView

Using this code...

Image.IO.LoadFromFileJpeg('Test.jpg');
SetLength (NodeArry, 4);

NodeArry[0].X := 510; NodeArry[0].Y := 175;
NodeArry[1].X := 570; NodeArry[1].Y := 175;
NodeArry[2].X := 570; NodeArry[2].Y := 270;
NodeArry[3].X := 510; NodeArry[3].Y := 270;
Image.LayersAdd (NodeArry,True,clRed,2,clBlue);
Image.CurrentLayer.Transparency := 75;
Image.CurrentLayer.Tag := 55;

NodeArry[0].X := 485; NodeArry[0].Y := 870;
NodeArry[1].X := 538; NodeArry[1].Y := 870;
NodeArry[2].X := 538; NodeArry[2].Y := 965;
NodeArry[3].X := 485; NodeArry[3].Y := 965;
Image.LayersAdd (NodeArry,True,clRed,2,clBlue);
Image.CurrentLayer.Transparency := 75;
Image.CurrentLayer.Tag := 56;

Image.LayersDeselectAll;

Image.LayersSelectAll(true);

Image.Update;

Both polygons display fine, with the last polygon defined is always selected.

Deselect and SelectAll don't seem to have any effect.

I also don't see a way to select a specific polygon given it's index, handle, or tag

Is there a demo that shows this? If so, I haven't been able to find it

Thanks in advance


HM Arnold

HMArnold

USA
33 Posts

Posted - Oct 01 2025 :  10:45:59  Show Profile  Reply
Also, what is the new TImageEnView way to add a text label at a pixel X/Y location?

In this case I already have a layer for the polygon.

I assume it is a new layer for each label, but then how do I locate it to a pixel coordinate near the polygon?

I can't find a Demo or Help section that describes setting the text location

HM Arnold
Go to Top of Page

xequte

39279 Posts

Posted - Oct 02 2025 :  01:19:29  Show Profile  Reply
Hi

You can just make the a layer active and selected using LayersCurrent:

ImageEnView1.LayersCurrent := 1;

In a multi-selection scenario, you can use:

http://www.imageen.com/help/TImageEnView.LayersSelectedList.html
or
http://www.imageen.com/help/TImageEnView.Selected.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

39279 Posts

Posted - Oct 02 2025 :  01:23:15  Show Profile  Reply
Hi

You can get the size and position of the layer using ImageEnView1.Layers[...].PosX/PosY/Width/Height (in terms of bitmap pixels).

You can then use that to add a text layer using the position the overload:

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

Or just add the layer then set ImageEnView1.CurrentLayer.PosX/PosY/Width/Height.

See the example at:

http://www.imageen.com/help/TIELayer.PosX.html


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