//the return value is the number of scan lines copied.
int CDib::Draw(HDC hdc, int XDest, int YDest, int nDestWidth,
int nDestHeight, int XSrc, int YSrc,
int nSrcWidth, int nSrcHeight,
unsigned int iUsage, unsigned long dwRop
,long RectW,long RectH)
{
XDest = (int) ((RectW-nSrcWidth)/2);
YDest = (int) ((RectH-nSrcHeight)/2);
if (m_pRGBQuad) // Has a color table
{
HPALETTE hPalette = CreateBitmapPalette();
HPALETTE hOldPalette = ::SelectPalette(hdc, hPalette, FALSE);
::RealizePalette(hdc);