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

This function translates an array of points from device coordinates to image coordinates.

Declaration:

 
Copy Code
AT_ERRCOUNT  ACCUAPI  IG_dspl_device_to_image(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HWND hWnd,
        [IN] HDC hDC,
        [IN/OUT] LPAT_POINT lpPoint,
        [IN] UINT nCount
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of the group from which to get the display options.
hWnd HWND Handle of the window where the image is drawn.
hDC HDC Handle of the device context used for drawing. This can be NULL, but if a calculation is necessary for a printer device context, then you should provide the real value.
lpPoint LPAT_POINT Pointer to an array of points that should be translated.
nCount UINT Number of elements in the lpPoint array.

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:

Image Processing, Clipboard

Example:

 
Copy Code
HIGEAR hIGear;     /* HIGEAR handle of image  */ 
DWORD           nGrpID;     /* display group identifier  */
AT_POINT p[2];       /* array of point to translate  */
RECT            rc;
 ...
/* calculate coordinates in image coordinate space of current client rectangle of the
window */   
GetClientRect( hWnd, &rc );
p[0].x = rc.left;
p[0].y = rc.top;
p[1].x = rc.right;
p[1].y = rc.bottom;
IG_dspl_device_to_image( hIGear, nGrpID, hWnd, NULL, p, 2 );
 ...

Remarks:

This function takes into account all display parameters including orientation and current scrolling position.

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