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

This function calculates DisplayedImageRect, which is the exact rectangle in which the image is to be scaled.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_dspl_image_calc( 
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HWND hWnd,
        [IN] HDC hDC,
        [OUT] LPAT_RECTANGLE lpActualDeviceRect
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle from which to get options and pixel data.
dwGrpID DWORD Identifier of group from which to get display options.
hWnd HWND Handle of window where image is to be displayed. Can be NULL, but in this case some display options may be calculated incorrectly if they are not set explicitly.
hDC HDC Handle of the device context where image is to be drawn.
lpActualDeviceRect LPAT_RECTANGLE Pointer to the rectangle in which to copy DisplayedImageRect. This rectangle is calculated no matter whether hDC=NULL or not. 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:

None

Example:

 
Copy Code
HIGEAR                   hIGear;         /* HIGEAR handle of image                                       */ 
DWORD                   nGrpID;         /* Display group identifier                                     */
AT_RECTANGLE                     DisplayedRect;
...
case WM_PAINT:
        BeginPaint(hWnd, &ps);
        if (IG_image_is_valid(hIGear))
                IG_dspl_image_calc( hIGear, nGrpID, hWnd, ps.hdc, &DisplayedRect );
        EndPaint(hWnd, &ps);
        break;

Remarks:

All options for drawing the image are taken from the dwGrpID group. This function does not perform any drawing, whether hDC is NULL or not.