Mapping functions alter and retrieve information about the GDI mapping modes. In order to maintain device independence, GDI creates output in a logical space and maps it to the display. The mapping mode defines the relationship between units in the logical space and pixels on a device. The following list briefly describes each mapping function:
Function | Description | |
GetMapMode | Retrieves the current mapping mode. | |
GetViewportExt | Retrieves a device context's viewport extents. | |
Function | Description | |
GetViewportOrg | Retrieves a device context's viewport origin. | |
GetWindowExt | Retrieves a device context's window extents. | |
GetWindowOrg | Retrieves a device context's window origin. | |
OffsetViewportOrg | Modifies a viewport origin. | |
OffsetWindowOrg | Modifies a window origin. | |
ScaleViewportExt | Modifies the viewport extents. | |
ScaleWindowExt | Modifies the window extents. | |
SetMapMode | Sets the mapping mode of a specified device context. | |
SetViewportExt | Sets a device context's viewport extents. | |
SetViewportOrg | Sets a device context's viewport origin. | |
SetWindowExt | Sets a device context's window extents. | |
SetWindowOrg | Sets a device context's window origin. |
There are eight different mapping modes to use: MM_ANISOTROPIC, MM_HIENGLISH, MM_HIMETRIC, MM_ISOTROPIC, MM_LOENGLISH, MM_LOMETRIC, MM_TEXT, and MM_TWIPS. Each mode has a specific use in a Windows application. Table 2.2 summarizes the eight GDI mapping modes:
Table 2.2 GDI Mapping Modes
Mapping Mode | Intended Use |
MM_ANISOTROPIC | Used in applications that map one logical unit to an arbitrary physical unit. The x- and y-axes are arbitrarily scaled. |
MM_HIENGLISH | Used in applications that map one logical unit to 0.001 inch. Positive y extends upward. |
MM_HIMETRIC | Used in applications that map one logical unit to 0.01 millimeter. Positive y extends upward. |
MM_ISOTROPIC | Used in applications that map one logical unit to an arbitrary physical unit. One unit along the x-axis is always equal to one unit along the y-axis. |
Table 2.2 GDI Mapping Modes (continued)
Mapping Mode | Intended Use | |
MM_LOENGLISH | Used in applications that map one logical unit to 0.01 inch. Positive y extends upward. | |
MM_LOMETRIC | Used in applications that map one logical unit to 0.1 millimeter. Positive y extends upward. | |
MM_TEXT | Used in applications that map one logical unit to one pixel. Positive y extends downward. | |
MM_TWIPS | Used in applications that map one logical unit to 1/1440 inch (1/20 of a printer's point). Positive y extends upward. | |
, |