Sdílet prostřednictvím


AfxDrawDitheredBitmap

Draws a bitmap, replacing its background with a dithered (checker) pattern.

void AFXAPI AfxDrawDitheredBitmap(
   CDC *pDC,
   int x,
   int y,
   const CBitmap &rSrc,
   COLORREF cr1,
   COLORREF cr2
);

Parameters

  • pDC
    Points to the destination DC.

  • x
    The destination x-coordinate.

  • y
    The destination y-coordinate.

  • rSrc
    The source bitmap.

  • cr1
    One of the two dither colors, typically white.

  • cr2
    The other dither color, typically light gray (COLOR_MENU).

Remarks

The source bitmap is drawn on the destination DC with a two-color (cr1 and cr2) checkered pattern replacing the bitmap's background. The background of the source bitmap is defined as its white pixels and all pixels matching the color of the pixel in the upper-left corner of the bitmap.

Dither Bitmap Sample

Example

void CDCView::DrawDitheredBitmap(CDC* pDC)
{
   CBitmap bm;
   bm.LoadBitmap(IDB_BITMAP1);
   AfxDrawDitheredBitmap(pDC, 10, 50, bm, RGB(255,255,255),
      GetSysColor(COLOR_BTNFACE));
}

Requirements

Header: afxwin.h

See Also

Reference

AfxGetDitheredBitmap

AfxDrawGrayBitmap

Concepts

MFC Macros and Globals

Other Resources

Gray and Dithered Bitmap Functions