CreateDIBPatternBrush

  HBRUSH CreateDIBPatternBrush(hglbDIBPacked, fuColorSpec)    
  HGLOBAL hglbDIBPacked; /* handle of device-independent bitmap (DIB) */
  UINT fuColorSpec; /* color-table data */

The CreateDIBPatternBrush function creates a logical brush that has the pattern specified by the given device-independent bitmap (DIB). The brush can subsequently be selected into any device context that is associated with a device which supports raster operations.

Parameters

hglbDIBPacked

Identifies a global memory object containing a packed device-independent bitmap. A packed DIB consists of a BITMAPINFO data structure immediately followed by the array of bytes which define the pixels of the bitmap. The BITMAPINFO structure has the following form:

typedef struct tagBITMAPINFO { /* bmi */

BITMAPINFOHEADER bmiHeader;

RGBQUAD bmiColors[1];

} BITMAPINFO;

fuColorSpec

Specifies whether the bmiColors member of the BITMAPINFO structure was initialized and if so, whether this member contains explicit RGB values or indices into a logical palette. The fuColorSpec parameter must be one of the following values:

Value Meaning

DIB_PAL_COLORS The color table is provided and consists of an array of 16-bit indices into the logical palette of the DC that the brush will be selected into.
DIB_RGB_COLORS The color table is provided and contains literal RGB values.
DIB_PAL_INDICES No color table is provided. The bitmap itself contains indices into the logical palette of the DC which the brush will be selected into.

Return Value

The return value identifies a logical brush if the function is successful. Otherwise, it is NULL.

Comments

This function is included only for compatibility purposes. Applications are discouraged from using this call. An application should use CreateDIBPatternBrushPt.

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 background and foreground 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 foreground color, and pixels mapped to the second color (at offset 1 in the color table) are displayed using the background color.

See Also

BITMAPINFO, CreateHatchBrush, CreatePatternBrush, CreateSolidBrush, CreateDIBPatternBrushPt SetTextColor, SetBkColor