ImageGear for C and C++ on Linux v20.0 - Updated
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.


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


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++.


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 =;
ZoomRect.width = (rc.right - rc.left + 1)/2;
ZoomRect.height = (rc.bottom - + 1)/2;
IG_dspl_zoom_to_rect( hIGear, nGrpID, hWnd,  &ZoomRect, NULL, NULL );


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.

Is this page helpful?
Yes No
Thanks for your feedback.