Mapping mode:
The coordinate mapping used in Visual C + + makes the user graphics coordinates exactly the same as the output setting.
Eg: when the screen has a pixel size of 800x600, each inch contains a screen pixel of 96, and the printer needs several points to achieve the same logical size
Therefore, the coordinate mapping method can be converted, which means that the proportion of coordinates used by the printer is several times larger than that of the display.
Mapping mode: When drawing on a screen or printer, you can use inches or millimeters instead of as units (instead of pixels), which is often more intuitive.
PS: Device unit, logical unit
Device units: is the x and Y values passed to the drawing function, they can represent inches and millimeters
Logical units: x, y pixels on the screen, or the number of dots on the printer.
Click on the mouse to return to device units, if you want to know where the mouse click on the bitmap location, you need to convert device units into logical units.
Available mapping modes
Mapping mode |
Logical units |
Mm_text |
1px |
Mm_lometric |
0.1mm |
Mm_himetric |
0.01mm |
Mm_loenglish |
0.01 inch |
Mm_hienglish |
0.001 inch |
Mm_twips |
1/1440 inch |
Mm_isotropic |
User-defined value, but the X and y directions are equal (equal) |
Mm_anisotropic |
User-defined values, but the X and Y directions are arbitrary |
The mapping mode is set by a member function Setmapmode () of the device environment class, as long as the above flag is passed as a parameter to the function. When mapping mode is set, the coordinate values passed to any drawing function are converted to device coordinates through the mapping mechanism inside GDI.
Ps:mm_text mode, the positive direction of the y-axis is perpendicular to the screen, and the x-axis is along the screen to the right
In other modes, the y-axis is vertically upward along the screen, and the x-axis is along the screen backwards
Visual C + + PRINT programming technology-programming Basics-mapping mode