Filling modes.
The
coordinates for most graphical operations are provided in
the form of logical coordinates. Logical coordinates are
translated into device coordinates through what is called
coordinate mapping.
Mapping
defines a linear relationship between the logical and the
physical coordinate space. Mapping matches the origin of
the logical coordinate space to the origin of the physical
coordinate space, and also matches logical and
physical
coordinate units. Mapping in the horizontal and vertical
directions may be independent of each other.
Windows
defines a set of mapping modes. These mapping modes can be
set using the SetMapMode member function.
On a raster
device such as the screen or printer, device
coordinates
represent pixel coordinates. The upper-left corner is
assigned the coordinates [0,0]; the horizontal coordinate
increases from left to right, the vertical coordinate
increases from top to bottom.
Of the many
predefined mapping modes,
MM_TEXT matches logical
coordinates to physical
coordinates. Other predefined
mapping modes reverse the direction of the horizontal
coordinate, so it grows from bottom to top. These mapping
modes are listed in Table 1.
|
|
MM_LOENGLISH
|
100
logical units equal one inch on the device
|
MM_HIENGLISH
|
1,000
logical units equal one inch on the device
|
MM_LOMETRIC
|
100
logical units equal one centimeter on the device
|
MM_HIMETRIC
|
1,000
logical units equal one centimeter on the device
|
MM_TWIPS
|
One
logical unit is one twentieth of a point
(1/1440")
|
In all of
these mapping modes, applications can use the SetWindowOrg
and SetViewportOrg functions to set the origin of the
logical coordinate space (window) and physical coordinate
space (viewport). The significance of these settings is
that the two origins are mapped onto each other when
coordinates are transformed.
In addition
to MM_TEXT and the mapping modes in Table
1, Windows
also defines the MM_ISOTROPIC and
MM_ANISOTROPIC mapping
mode. In these mapping modes, applications can not only
specify the origin, but also the extent of the window and
viewport coordinate space. By specifying the extent,
applications define how many logical units are mapped to
how many physical units. The difference between
MM_ISOTROPIC and MM_ANISOTROPIC is that in the former
mode, applications only define extents in the horizontal
direction, while Windows calculates the vertical extent
preserving the device aspect ratio. In the latter mode,
applications can freely define any extents in both
directions.
Figure 3
illustrates the effects of a typical mapping from logical
to physical coordinates.
Note:
UCanCode Advance E-XD++
CAD Drawing and Printing Solution
Source Code Solution for C/C++, .NET V2024 is released!
Contact UCanCode Software
To buy the source code or learn more about with: