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 always in center?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

dracola

Argentina
37 Posts

Posted - Oct 17 2015 :  04:17:38  Show Profile  Reply
I used imageenvect, and load an image, than i create a square object around the image.
after i do rotate an resample to the image, the square object always anchor at position 0,0 (top left)
how i make the square object always at centre of the image after i do rotate or resample?

thank's

xequte

39076 Posts

Posted - Oct 19 2015 :  18:00:16  Show Profile  Reply
Sorry, can you give me a sample of your code.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

dracola

Argentina
37 Posts

Posted - Oct 19 2015 :  22:29:45  Show Profile  Reply
procedure TForm1.FormShow(Sender: TObject);
begin
 //load images
 ImageEnVect1.Zoom:=20;
 ImageEnVect1.IO.LoadFromFile('C:\15052149 ely\IMG_8738 copy.jpg');

 //add square object around image
 ImageEnVect1.AddNewObject(iekBOX, Rect( 0, 0 ,ImageEnVect1.Bitmap.Width,ImageEnVect1.Bitmap.Height;), clred);


end;



procedure TForm1.Zoom(Sender: TObject);
begin
  ImageEnVect1.CurrentLayer.Bitmap.Resample(ImageEnVect1.CurrentLayer.Bitmap.Width+10, -1, rfTriangle, True);

 ImageEnVect1.Update;
end;



Go to Top of Page

dracola

Argentina
37 Posts

Posted - Oct 19 2015 :  22:32:40  Show Profile  Reply
How to make the red square object always at center position, after i do zooming.
thank's
Go to Top of Page

xequte

39076 Posts

Posted - Oct 21 2015 :  16:46:51  Show Profile  Reply
Hi

Objects are not moved when the background bitmap changes.

You will need to move the objects after resampling:

1. Get the size of the bitmap
2. Resample the bitmap
3. Iterate through all the objects changing ObjLeft[] and ObjTop[] by NewSize - OldSize div 2

There is an iteration example at:

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


Good luck to Argentina in the Rugby World Cup semi-final this weekend!

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

dracola

Argentina
37 Posts

Posted - Oct 22 2015 :  04:37:17  Show Profile  Reply
i will try it, thank you for quick respond ^_^

....typing...typing source code...
....
...compile...
....

yeahhhh...it's work
thank's so much ^_^
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: