BOOL CreateDIBPatternBrush( GLOBALHANDLE hPackedDIB, UINT wUsage );
hPackedDIB
Identifies a global-memory object containing a packed device-independent bitmap.
wUsage
Specifies whether the bmiColors[] fields of the BITMAPINFO data structure contain explicit RGB values or indexes into the currently realized logical palette. The parameter must be one of the following values:
Value | Meaning |
DIB_PAL_COLORS | The color table contains literal RGB values. |
DIB_RGB_COLORS | The color table consists of an array of 16-bit indexes. |
Initializes a brush with the pattern specified by a device-independent bitmap (DIB). The brush can subsequently be selected for any device context that supports raster operations.
To obtain a handle to the DIB, you call the Windows GlobalAlloc function to allocate a block of global memory and then fill the memory with the packed DIB. A packed DIB consists of a BITMAPINFO data structure immediately followed by the array of bytes that define the pixels of the bitmap.
The BITMAPINFO structure has the following form:
typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
Bitmaps used as fill patterns should be 8 pixels by 8 pixels.
When an application selects a two-color DIB pattern brush into a monochrome device context, Windows ignores the colors specified in the DIB and instead displays the pattern brush using the current text and background colors of the device context. Pixels mapped to the first color (at offset 0 in the DIB color table) of the DIB are displayed using the text color. Pixels mapped to the second color (at offset 1 in the color table) are displayed using the background color.
TRUE if successful; otherwise FALSE.
CBrush::CreatePatternBrush, CBrush::CreateBrushIndirect, CBrush::CreateSolidBrush, CBrush::CreateHatchBrush, CGdiObject::CreateStockObject, ::CreateDIBPatternBrush, ::GlobalAlloc