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
 How to keep and load the polygon selection
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Sit777

Turkmenistan
1 Posts

Posted - Nov 18 2015 :  00:14:52  Show Profile  Reply
How to get the polygon selection (in TImageEnView or TImageEnVect), save and then load it. For example ( for rectangle):
get points for save - TImageEnVect.SelX1 (SelX2,SelY1,SelY2);
load selection from points - TImageEnVect.Select (100,200,300,400, iespReplace);
And how to do it for a polygon?

xequte

39108 Posts

Posted - Nov 18 2015 :  17:11:50  Show Profile  Reply
Hi

You can use TImageEnView.PolySel to get the points of a polygon selection:

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

var
  MyPolySelArray: array of TPoint;
  I: Integer;
begin
  // Create an array of TPoints of the polygon selection in a TImageEnView
  SetLength( MyPolySelArray, ImageEnView1.PolySelCount );
  for I := 0 to ImageEnView1.PolySelCount - 1 do
    MyPolySelArray[ I ] := ImageEnView1.PolySel[ I ];
end;


Also see: http://www.imageen.com/help/TImageEnView.PolySelPoints.html


To recreate your selection, iterate through your point array calling:

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

Then call EndSelect.

// Create a polygon selection from an array of TPoints
for I := Low( MyPolySelArray ) to High( MyPolySelArray ) do
  ImageEnView1.AddSelPoint( MyPolySelArray[ I ].x, MyPolySelArray[ I ].y );
ImageEnView1.EndSelect();



Of course, you can also use SaveSelectionToStream and LoadSelectionFromStream


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: