Bitmaps as Brushes
The Win32 API provides a number of functions that use the brush currently
selected into a device context to perform bitmap operations. For example, the
PatBlt function replicates the brush in a rectangular region within a window, and
the
FloodFill function replicates the brush inside an area in a window bounded by the
specified color (unlike
PatBlt,
FloodFill does fill nonrectangular shapes).
The
PatBlt function name (an abbreviation for pattern block transfer) implies that the
function simply replicates the brush (or pattern) until it fills a specified
rectangle. However, the function is actually much more powerful. Before
replicating the brush, it combines the color data for the pattern with the color data for
the existing pixels on the video display by using a raster operation (ROP). An
ROP is a bitwise operation that is applied to the bits of color data for the
replicated brush and the bits of color data for the target rectangle on the
display device. There are 256 ROPs in the Win32 API; however, the
PatBlt function recognizes only those that require a pattern and a destination (not
those that require a source). The following table identifies the five most
common ROPs.
ROP
| Description
|
PATCOPY
| Copies the pattern to the destination bitmap.
|
PATINVERT
| Combines the destination bitmap with the pattern by using the Boolean OR
operator.
|
DSTINVERT
| Inverts the destination bitmap.
|
BLACKNESS
| Turns all output to binary zeroes.
|
WHITENESS
| Turns all output to binary ones.
|
The
FloodFill function replicates the brush within a region bounded by a specified color.
However, unlike the
PatBlt function,
FloodFill does not combine the color data for the brush with the color data for the
pixels on the display; it simply sets the color of all pixels within the enclosed
region on the display to the color of the brush that is currently selected into
the device context.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database