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
 Zooming with fixed TopLeft pixel?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

agnes

USA
2 Posts

Posted - May 25 2013 :  18:48:29  Show Profile  Reply
Hi,

I am trying to figure out the following...

I have a bitmap that will be zoomed larger than its ImageEnView1 component. Now, whereever I pan the image to, I would like to zoom in and out (with a button/code) without the current TopLeft pixel moving. I would expect it to move when zooming smaller than the component would allow for. Thanks.
--Aggie

fab

1310 Posts

Posted - May 27 2013 :  13:13:48  Show Profile  Reply
Hi,
ImageEn "direct" the zoom at the center.
You may change this, scrolling to the pixel you want to display, just after setting zoom. Example:

ImageEnVect1.Zoom := ....;
ImageEnView1.ViewX := 0;
ImageEnView1.ViewY := 0;

You could also set ImageEnView1.Center=false (this is not an alternative way).
Go to Top of Page

agnes

USA
2 Posts

Posted - May 29 2013 :  20:33:13  Show Profile  Reply
fab,

Thanks for pointing me in the right direction. Here is what I came up with. Works well with 50%, 100%, 200%, etc.

//--------------------------------------------------------------------
procedure TForm1.ZoomFromTopLeft(AImage: TImageEnVect; AZoom: double);
var
newViewX, newViewY : integer ;
begin
with AImage do
begin
newViewX := Trunc(AZoom / Zoom * ViewX);
newViewY := Trunc(AZoom / Zoom * ViewY);
Perform(WM_SETREDRAW, 0, 0);
Zoom := AZoom;
ViewX := newViewX;
ViewY := newViewY;
Perform(WM_SETREDRAW, 1, 0);
Invalidate;
end;
end;
//--------------------------------------------------------------------

I was ready to tear my hair out trying to find a bitmap point, screen point, client point -- that could be plugged into the ZoomAt procedure. FYI, my project is for viewing census scans, and needs to remain at the same line/column when zooming. Thanks again!

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: