Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CBrush::CreateDIBPatternBrush
CBrush                                      Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  BOOL CreateDIBPatternBrush( GLOBALHANDLE hPackedDIB, UINT nUsage );
 
  Parameter    Description
 
  <hPackedDIB> Identifies a global-memory object containing a packed
               device-independent bitmap.
 
  <nUsage>     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.
 
  Remarks
 
  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.
 
  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.
 
  Return Value
 
  TRUE if successful; otherwise FALSE.
 
  See Also
 
  CBrush::CreatePatternBrush, CBrush::CreateBrushIndirect,
  CBrush::CreateSolidBrush, CBrush::CreateHatchBrush,
  CGdiObject::CreateStockObject, ::CreateDIBPatternBrush,
  ::GlobalAlloc
 
 
                                     -♦-