context object has many attributes that can be set or
retrieved through CDC member functions. Of these, we
review attributes that relate to mapping modes and
coordinate transformations in the next section. This
section focuses on other attributes.
background color, used to fill the gaps in styled lines,
hatched brushes, and in character cells, is set by the
SetBkColor member function. The current background color
can be retrieved by calling GetBkColor. The background
mode, which determines whether the background is
transparent or opaque, is set by calling SetBkMode;
GetBkMode retrieves the current background mode.
member function can be used to set the drawing mode. The
drawing mode determines how bits in the drawing tool and
bits on the device surface are combined. The default
drawing mode is R2_COPYPEN; in this mode, pixels from the
drawing tool are copied over pixels in the device bitmap.
This is what you would expect as normal behavior; as you
draw with a specific pen or brush, the pen or brush will
simply overwrite what may already be on the device context
several other commonly used drawing modes that can be set
with SetROP2. These include, for example, R2_BLACK (the
target pixels turn always black), R2_NOTCOPYPEN (the
target pixel acquires a color that is the inverse of the
drawing tool's color), or R2_XORPEN (the target pixel's
color is formed by performing an exclusive OR operation
between the target pixel and the pixel in the drawing
modes are not restricted to these preset values; the
drawing mode setting can specify an arbitrary binary
operation between pixels of the device surface and pixels
of the drawing tool.
drawing mode setting can be acquired by calling
Note that drawing mode settings are specific to raster
devices and have no effect on vector devices, like
SetPolyFillMode function determines the polygon filling
mode. The difference between the ALTERNATE and WINDING
filling modes is illustrated in Figure 2. The current
filling mode can be retrieved by calling GetPolyFillMode.
UCanCode Advance E-XD++
CAD Drawing and Printing Solution
Source Code Solution for C/C++, .NET V2021 is released!
Contact UCanCode Software
To buy the source code or learn more about with: