ImageGear for C and C++ on Windows v19.1 - Updated
IG_dspl_zoom_to_rect
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_zoom_to_rect

This function calculates the zoom and scroll values, so that the specified rectangle is fitted to ClipRect.

Declaration:

 
Copy Code
AT_ERRCOUNT   ACCUAPI   IG_dspl_zoom_to_rect(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HWND hWnd,
        [IN] const LPAT_RECTANGLE lpZoomRect,
        [OUT] LPDOUBLE lpdblHZoom,
        [OUT] LPDOUBLE lpdblVZoom
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group in which to set zoom_to_rect options.
hWnd HWND Handle of window where image is drawn.
lpZoomRect const LPAT_RECTANGLE Pointer to the rectangle in device coordinates that should be fitted into ClipRect.
lpdblHZoom LPDOUBLE Pointer to where to return the newly calculated ZoomValueH value. If NULL, then this parameter is ignored.
lpdblVZoom LPDOUBLE Pointer to where to return the newly calculated ZoomValueV value. If NULL, then this parameter is ignored.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Display

Example:

 
Copy Code
HIGEAR           hIGear;       /* HIGEAR handle of image  */ 
DWORD           nGrpID;        /* display group identifier */
AT_RECTANGLE            ZoomRect;     /* rectangle where to zoom  */
RECT            rc;
 ...
GetClientRect( hWnd, &rc );
ZoomRect.x = rc.left;
ZoomRect.y = rc.top;
ZoomRect.width = (rc.right - rc.left + 1)/2;
ZoomRect.height = (rc.bottom - rc.top + 1)/2;
IG_dspl_zoom_to_rect( hIGear, nGrpID, hWnd,  &ZoomRect, NULL, NULL );
 ...

Remarks:

It assigns ZoomMode=IG_DSPL_ZOOM_H_FIXED| IG_DSPL_ZOOM_V_FIXED, calculates and modifies ZoomValueH, ZoomValueV, and the horizontal and vertical scroll positions. It does not change the value of rectangles DeviceRect, ImageRect and ClipRect.