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
 How to keep and load the polygon selection

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
Sit777 Posted - Nov 18 2015 : 00:14:52
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?
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 18 2015 : 17:11:50
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