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
 ieVect Objects, Select, set Center point, Distort
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

andyhill

Australia
159 Posts

Posted - Apr 26 2016 :  22:46:57  Show Profile  Reply
I have many ieVect Objects, I want to select them via code (this returns a select rectangle).

I want to setup a new reference Center Point in code for the new select rectangle.

I now want to stretch/distort the selected objects based on my new select rectangle reference Center Point and my new select rectangle handle point (in this case bottom/right) position.

I want to do this all in code, please advise - thanks in advance.



Andy

andyhill

Australia
159 Posts

Posted - Apr 26 2016 :  22:50:13  Show Profile  Reply




Andy
Go to Top of Page

andyhill

Australia
159 Posts

Posted - Apr 27 2016 :  16:37:37  Show Profile  Reply
I should have advised that all the objects are polygons

Andy
Go to Top of Page

xequte

39056 Posts

Posted - May 03 2016 :  22:03:51  Show Profile  Reply
Hi Andy

You would need to iterate through the points of the polygon, using:

www.imageen.com/help/TImageEnVect.ObjPolylinePoints.html

Building a new array, adjusted to handle the distortion, and then set the new array using:

http://www.imageen.com/help/TImageEnVect.SetObjPolylinePoints.html


Unfortunately there are no methods in ImageEn to handle this kind of distortion, you would need to code something yourself. I imagine it would work something like:

1. Get Point X, Y
2. If X <= Center_X do nothing, else scale X by New_Width - Center_X / Old_Width - Center_X
3. If Y <= Center_Y do nothing, else scale Y by New_Height - Center_Y / Old_Height - Center_Y
Note: This assumes a bottom, right distortion, obviously you would also need to handle negative distortions

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: