home Tech Library Tech Forum
Publisher
 
The Document View Architecture        
 
 
Mapping Modes
 
 

 

Graphics and text output are passed as coordinates in the device context that specify where they should be painted. The default mapping is MM_TEXT where the units are called device units and we have one screen pixel, or printer dot, per unit. Mapping modes permit the user to define logical units, and then the operating system figures out how to map it to your selected output device. Logical units can be in inches or millimeters, in which case the operating system figures out how big an inch or a millimeter is (in screen pixels or printer dots), and plots or prints the output there.

Mapping Mode  and Meaning
MM_TEXT Default mapping mode; each logical unit equals one device unit (screen pixel or printer dot). X increases to the right, Y increases downward.

Fixed Scale Mapping Modes:
(For all fixed scale modes, X increases to the right, Y increases upward.)
MM_LOENGLISH Each logical unit is 0.01 inch (low resolution).
MM_HIENGLISH Each logical unit is 0.001 inch (high resolution).
MM_LOMETRIC Each logical unit is 0.1 millimeter (low resolution).
MM_HIMETRIC Each logical unit is 0.01 millimeter (high resolution).
MM_TWIPS Used with text fonts. Each logical unit is 1/20 point, or 1/1440 of an inch.

Variable Scale:
MM_ISOTROPIC Arbitrary scaling of the axes, but the X and Y scaling must be the same.
MM_ANISOTROPIC Either axis can have any scaling factor. This is the most flexible mode.

Two mapping modes, MM_ISOTROPIC and MM_ANISOTROPIC, allow you to change the scale factor as well as the origin. With the MM_ISOTROPIC mode, a 1:1 aspect ratio is always preserved. And with the M_ANISOTROPIC mode, the X and Y scale factors can change independently. With the scaleable mapping modes, you use the two functions CDC::SetWindowExt(X, Y) and CDC::SetViewportExt(X, Y) together to set the scaling of the coordinate system.

The functions SetWindowExt(X,Y) and SetViewportExt(X,Y) work together to set the scale, based on the window’s scale. SetWindowExt(X,Y) defines the window’s coordinates. SetViewportExt(X,Y) defines the printer’s coordinates. The scale factor is the ratio of the values provided in these two functions.
 
     
   
  RELATED TOPICS  
Document-View Architecture
Message Routing
PreCreateWindow() Function
OnDraw() Function
Document Template
RUNTIME_CLASS Macro
CView Class
Print from the View
The Function OnPrepareDC()
Serialization using CArchive class
Diagnostic Helpers
 


 
           
Home | Profile | Users | Library | Publisher | Tech Forum | News | Contact Us