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

This function sets the current map mode and logical coordinate system.

Declaration:

 
Copy Code
AT_ERRCOUNT  ACCUAPI  IG_dspl_mapmode_set(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] DWORD dwMapMode,
        [IN] const LPAT_RECTANGLE lpViewport,
        [IN] const LPAT_RECTANGLE lpWindow
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group in which to set map mode options.
dwMapMode DWORD New value of option MapMode to assign.
LpViewport const LPAT_RECTANGLE New value of Viewport option to assign.
LpWindow const LPAT_RECTANGLE New value of Window option to assign.

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, MFC, MFC Threads

Example:

 
Copy Code
HIGEAR           hIGear;     /* HIGEAR handle of image  */ 
DWORD           nGrpID;      /* display group identifier  */
DWORD           dwMapMode;       /* map mode   */
AT_RECTANGLE            Viewport;         /* view port values  */
AT_RECTANGLE             Window;          /* window values  */
POINT           p;
SIZE            s;
 ...
/* get current mapping parameters */
dwMapMode = GetMapMode( hDC );
GetViewportOrgEx( hDC, &p );
Viewport.x = p.x;
Viewport.y = p.y;
GetViewportExtEx( hDC, &s );
Viewport.width = s.cx;
Viewport.height = s.cy;
GetWindowOrgEx( hDC, &p );
Window.x = p.x;
Window.y = p.y;
GetWindowExtEx( hDC, &s );
Window.width = s.cx;
Window.height = s.cy;
IG_dspl_mapmode_set( hIGear, nGrpID, dwMapMode, &Viewport, &Window );
 ...

Remarks:

ImageGear will perform all calculations with the assumption that the specified logical system is used for the device coordinates.