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
 Obj Top and Left after Rotation
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - May 06 2012 :  22:49:51  Show Profile  Reply
After calling RotateAllOBjects, the ObjTop and ObjLeft are no longer the same. I use the following code to show and bring the object into view:

xx:=trunc( ImageEnVect1.ObjLeft[0] * (ImageEnVect1.Zoom/100) );
yy:=trunc( ImageEnVect1.ObjTop[0] * (ImageEnVect1.Zoom/100) );
ImageEnVect1.SetViewXY( xx-5, yy-5 );

But since the ObjLeft and ObjTop is not correct, it is showing correctly. How do I get the correct ObjLeft and ObjTop after calling RoateAllObjects?

Thanks.

AndyColmes

USA
351 Posts

Posted - May 06 2012 :  23:37:12  Show Profile  Reply
I am actually using LoadFromFileIEV for the objects. After changing the rotation using RotateAllObjects and saving/loading the .iev file, the ObjTop and ObjLeft is no longer valid.

Thanks.

Go to Top of Page

AndyColmes

USA
351 Posts

Posted - May 07 2012 :  08:14:23  Show Profile  Reply
I was able to solve it by the following code:

if (Length(rt)>0) then begin //there's rotation
if (rt='90') then begin
t := ImageEnVect1.ObjTop[0] - ImageEnVect1.ObjHeight[0];
l := ImageEnVect1.ObjLeft[0];
end else if (rt='180') then begin
l := ImageEnVect1.ObjLeft[0] - ImageEnVect1.ObjWidth[0];
t := ImageEnVect1.ObjTop[0] - ImageEnVect1.ObjHeight[0];
end else if (rt='270') then begin
l := ImageEnVect1.ObjLeft[0] - ImageEnVect1.ObjWidth[0];
t := ImageEnVect1.ObjTop[0];
end;
end else begin
l := ImageEnVect1.ObjLeft[0];
t := ImageEnVect1.ObjTop[0];
end;

xx:=trunc( l * (ImageEnVect1.Zoom/100) );
yy:=trunc( t * (ImageEnVect1.Zoom/100) );
ImageEnVect1.SetViewXY( xx-5, yy-5 );
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: