Example #1
0
BOOL CScene::GetDIBs( LPPDIB lppCleanDIB, LPPDIB lppDirtyDIB, HDC FAR * lpDC )
/***********************************************************************/
{
	LPOFFSCREEN lpOffScreen = GetOffScreen();
	if ( !lpOffScreen )
	{
		if ( lppCleanDIB )
			*lppCleanDIB = NULL;
		if ( lppDirtyDIB )
			*lppDirtyDIB = NULL;
		if ( lpDC )
			*lpDC = NULL;
		return( NO );
	}
	else
	{
		if ( lppCleanDIB )
			*lppCleanDIB = lpOffScreen->GetReadOnlyDIB();
		if ( lppDirtyDIB )
			*lppDirtyDIB = lpOffScreen->GetWritableDIB();
		if ( lpDC )
			*lpDC = lpOffScreen->GetDC();
		return( YES );
	}
}
Example #2
0
void CPuzzle::OnDraw(HDC hDC, LPRECT lpRect, BOOL fGrid)
/***********************************************************************/
{
	int iPieces;
	RECT rOut, rClient, rPaint, rWindow;
	HDC hDCOut;
	POINT ptDst;
	PDIB pDibOut = NULL;

	GetClientRect(m_hWnd, &rClient);
	GetWindowRect(m_hWnd, &rWindow);
	if (!IntersectRect(&rPaint, &rClient, lpRect))
		return;
	if (!m_pDib)
		return;

	LPSCENE lpScene = CScene::GetScene(GetParent(m_hWnd));
	if (!lpScene)
		return;
	LPOFFSCREEN lpOffScreen = lpScene->GetOffScreen();
	if (lpOffScreen)
	{
		hDCOut = lpOffScreen->GetDC();
		rOut = rPaint;
		MapWindowPoints( m_hWnd, GetParent(m_hWnd), (LPPOINT)&rOut, 2 );
		MapWindowPoints( m_hWnd, GetParent(m_hWnd), (LPPOINT)&rClient, 2 );
		MapWindowPoints( NULL, GetParent(m_hWnd), (LPPOINT)&rWindow, 2 );
		pDibOut = lpOffScreen->GetWritableDIB();
	}
	else
		hDCOut = hDC;

	iPieces = m_iCols * m_iRows;
	for (int i = 0; i < iPieces; ++i)
		DrawPiece(i, hDCOut, pDibOut, (LPPOINT)&rClient.left, &rPaint, fGrid);

	if (m_iSelect >= 0)
	{
		if (m_bHintMode)
			DrawHint(m_iSelect, hDCOut, (LPPOINT)&rClient.left, &rPaint);
		DrawPiece(m_iSelect, hDCOut, pDibOut, (LPPOINT)&rClient.left, &rPaint, FALSE, &m_ptSelect);
	}

	// when we are all done we draw from the WinG DC to the output DC
	if (lpOffScreen)
	{
		ptDst.x = rPaint.left;
		ptDst.y = rPaint.top;
		lpOffScreen->DrawRect( hDC, &rOut, &ptDst );
	}
}
Example #3
0
LOCAL void Meter_OnDraw(HWND hWindow, HDC hDC, LPRECT lpRect, BOOL fHighlight)
/***********************************************************************/
{
    RECT	rSrcArea, rDstArea, rControlArea;
    POINT	ptDst;
    PDIB	pdibSrc, pdibDst, pdibSrc2, pdibTmp;
    UINT	id;
    LPOFFSCREEN lpOffScreen;
    LPSCENE lpScene;
    HDC		hWinGDC;
    HPALETTE hLoadPal;

    lpScene = CScene::GetScene( GetParent(hWindow) );
    if (!lpScene)
        return;

    LPMETERCONTINFO lpInfo;
    if (!(lpInfo = (LPMETERCONTINFO)GetWindowLong(hWindow, GWL_DATAPTR) ))
        return;

    rSrcArea = * lpRect;
    rDstArea = * lpRect;
    rControlArea = * lpRect;

    lpOffScreen = lpScene->GetOffScreen();
    if (lpOffScreen)
    {
        MapWindowPoints(hWindow, GetParent(hWindow), (LPPOINT)& rDstArea, 2);
        if (!(pdibSrc = lpOffScreen->GetReadOnlyDIB() ) )
            return;
        if (!(pdibDst = lpOffScreen->GetWritableDIB() ) )
            return;
        hWinGDC = lpOffScreen->GetDC();
        hLoadPal = GetApp()->m_hPal;
    }
    else
    {
        return;
    }

    RECT	rClient;
    GetClientRect(hWindow, & rClient);
    MapWindowPoints(hWindow, GetParent(hWindow), (LPPOINT)& rClient, 2 );

    // Get the control style
    DWORD dwStyle = GetWindowStyle(hWindow);
    BOOL bVert = (dwStyle & MC_VERT) ? TRUE : FALSE ;

    // Get the control id
    if (!(id = GetWindowWord(hWindow, GWW_ICONID) ) )
        id = GET_WINDOW_ID(hWindow);

    // Refresh the background,
    // compressed DIBs must use GDI copying (lose transparency ability)
    if (pdibSrc->GetCompression() == BI_RLE8 ||
            pdibDst->GetCompression() == BI_RLE8)
    {
        pdibSrc->DCBlt(hWinGDC,
                       rDstArea.left, rDstArea.top,
                       rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                       rDstArea.left, rDstArea.top,
                       rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top );
    }
    else
    {
        pdibSrc->DibBlt(pdibDst,
                        rDstArea.left, rDstArea.top,
                        rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                        rDstArea.left, rDstArea.top,
                        rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                        NO /*bTransparent*/ );
    }

    // Load the resource
    if (pdibSrc = CDib::LoadDibFromResource(GetWindowInstance(hWindow),
                                            MAKEINTRESOURCE(id), hLoadPal, (dwStyle & BS_MASK) != 0) )
    {
        if (pdibSrc2 = CDib::LoadDibFromResource(GetWindowInstance(hWindow),
                       MAKEINTRESOURCE(id + 1), hLoadPal, (dwStyle & BS_MASK) != 0) )
        {
            int iBitmapWidth = pdibSrc->GetWidth();
            int iBitmapHeight = pdibSrc->GetHeight();

            rSrcArea.left = 0;
            rSrcArea.top = 0;
            rSrcArea.right = rSrcArea.left + iBitmapWidth;
            rSrcArea.bottom = rSrcArea.top + iBitmapHeight;
            rDstArea = rClient;
            rDstArea.right = rDstArea.left + iBitmapWidth;
            rDstArea.bottom = rDstArea.top + iBitmapHeight;

            // Get the position width
            int iPosWidth;
            if (bVert)
            {
                iPosWidth = (int)( (float)iBitmapHeight *
                                   ((float)lpInfo->lPosition / ((float)lpInfo->Max - (float)lpInfo->Min)));
                iPosWidth = iBitmapHeight - iPosWidth;
            }
            else
            {
                iPosWidth = (int)( (float)iBitmapWidth *
                                   ((float)lpInfo->lPosition / ((float)lpInfo->Max - (float)lpInfo->Min)));
            }
            // compressed DIBs must use GDI copying (lose transparency ability)
            if (pdibSrc->GetCompression() == BI_RLE8 ||
                    pdibDst->GetCompression() == BI_RLE8 )
            {
                pdibSrc->DCBlt(hWinGDC,
                               rDstArea.left, rDstArea.top,
                               rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                               rSrcArea.left, rSrcArea.top,
                               rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top);
            }
            else
            {
                RGBTRIPLE rgb;
                LPRGBTRIPLE lpRGB = NULL;
                if (dwStyle & BS_MASK)
                {
                    STRING szColor;
                    GetWindowText(hWindow, szColor, sizeof(szColor));
                    AsciiRGB(szColor, & rgb);
                    if (fHighlight)
                    {
                        // this relies on the fact that AsciiRGB replaces commas
                        // with NULL terminators
                        LPTSTR lp = szColor + lstrlen(szColor) + 1; // passed red
                        lp += lstrlen(lp) + 1; // passed green
                        lp += lstrlen(lp) + 1; // passed blue to higlight color
                        AsciiRGB(lp, & rgb);
                    }
                    lpRGB = & rgb;
                }
                // Render the first bitmap
                pdibTmp = pdibSrc;
                pdibTmp->DibBlt(pdibDst,
                                rDstArea.left, rDstArea.top,
                                rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                                rSrcArea.left, rSrcArea.top,
                                rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top,
                                FALSE /*bTransparent*/, lpRGB);
            }

            // Adjust the source and dest rect's and render the 2nd bitmap

            if (bVert)
            {
                //rDstArea.top = rDstArea.top;// iPosWidth;
                rDstArea.bottom = rDstArea.top + iPosWidth;
                //rSrcArea.top = rSrcArea.bottom - iPosWidth;
                rSrcArea.bottom = iPosWidth;
            }
            else
            {
                rDstArea.right = rDstArea.left + iPosWidth;
                rSrcArea.right = rSrcArea.left + iPosWidth;
            }
            // compressed DIBs must use GDI copying (lose transparency ability)
            if (pdibSrc->GetCompression() == BI_RLE8 ||
                    pdibDst->GetCompression() == BI_RLE8 )
            {
                pdibSrc->DCBlt(hWinGDC,
                               rDstArea.left, rDstArea.top,
                               rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                               rSrcArea.left, rSrcArea.top,
                               rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top);
            }
            else
            {
                RGBTRIPLE rgb;
                LPRGBTRIPLE lpRGB = NULL;
                if (dwStyle & BS_MASK)
                {
                    STRING szColor;
                    GetWindowText(hWindow, szColor, sizeof(szColor));
                    AsciiRGB(szColor, & rgb);
                    if (fHighlight)
                    {
                        // this relies on the fact that AsciiRGB replaces commas
                        // with NULL terminators
                        LPTSTR lp = szColor + lstrlen(szColor) + 1; // passed red
                        lp += lstrlen(lp) + 1; // passed green
                        lp += lstrlen(lp) + 1; // passed blue to higlight color
                        AsciiRGB(lp, & rgb);
                    }
                    lpRGB = & rgb;
                }
                // Render the first bitmap
                pdibTmp = pdibSrc2;
                pdibTmp->DibBlt(pdibDst,
                                rDstArea.left, rDstArea.top,
                                rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
                                rSrcArea.left, rSrcArea.top,
                                rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top,
                                FALSE /*bTransparent*/, lpRGB);

            }
        }
        delete pdibSrc;
        delete pdibSrc2;
    }

    ptDst.x = rControlArea.left;
    ptDst.y = rControlArea.top;
    if (lpOffScreen)
    {
        lpOffScreen->DrawRect(hDC, & rClient, & ptDst);
    }
}
Example #4
0
//************************************************************************
void SpeedCheck( LPOFFSCREEN lpOffScreen, PDIB pdib )
//************************************************************************
{
#ifdef UNUSED
RGBQUAD rgb1, rgb2;

if (!lpOffScreen)
	return;

HDC hdc;
if ( !(hdc = GetDC(NULL)) )
	return;

WORD wNumEntries;
GetObject( GetApp()->m_hPal, sizeof(WORD), (LPSTR)&wNumEntries );
PALETTEENTRY sEntries[256], pEntries[256];
GetPaletteEntries( GetApp()->m_hPal, 0, wNumEntries, pEntries );
GetSystemPaletteEntries( hdc, 0, 256, sEntries );
ReleaseDC( NULL, hdc );

if ( wNumEntries != 256 )
	{
	Debug( "GetApp()->m_hPal only has %d entries\n", wNumEntries );
	}

// Compare the app's palette with the system palette
int i;
for ( i=0; i<256; i++ )
	{
	if ( pEntries[i].peRed	 != sEntries[i].peRed	||
		 pEntries[i].peBlue	 != sEntries[i].peBlue	||
		 pEntries[i].peGreen != sEntries[i].peGreen )
//		 pEntries[i].peFlags != sEntries[i].peFlags )
		{
		Debug( "GetApp()->m_hPal compare with syspal; entry %d (%d,%d,%d) (%d,%d,%d)\n", i,
			pEntries[i].peRed, pEntries[i].peGreen, pEntries[i].peBlue,
			sEntries[i].peRed, sEntries[i].peGreen, sEntries[i].peBlue );
//		break;
		}
	}

PDIB pdibr, pdibw;
LPWORD lpIndices;

// Compare the system palette with the WRITABLE offscreen
if ( pdibw = lpOffScreen->GetWritableDIB() )
	{
	RGBQUAD FAR *lprgbQuad = pdibw->GetColors();
	for ( i=0; i<256; i++ )
		{
		rgb1 = lprgbQuad[i];
		if ( rgb1.rgbRed   != sEntries[i].peRed	  ||
			 rgb1.rgbGreen != sEntries[i].peGreen ||
			 rgb1.rgbBlue  != sEntries[i].peBlue )
			{
			Debug( "OS writable compare with syspal; entry %d (%d,%d,%d) (%d,%d,%d)\n", i,
				rgb1.rgbRed, rgb1.rgbGreen, rgb1.rgbBlue,
				sEntries[i].peRed, sEntries[i].peGreen, sEntries[i].peBlue );
//			break;
			}
		}
	}

// Compare the READONLY offscreen with the WRITABLE offscreen
if ( (pdibr = lpOffScreen->GetReadOnlyDIB()) &&
	 (pdibw = lpOffScreen->GetWritableDIB()) )
	{
	RGBQUAD FAR *lprQuad = pdibr->GetColors();
	RGBQUAD FAR *lpwQuad = pdibw->GetColors();
	for ( i=0; i<256; i++ )
		{
		rgb1 = lprQuad[i];
		rgb2 = lpwQuad[i];
		if ( rgb1.rgbRed   != rgb2.rgbRed	||
			 rgb1.rgbGreen != rgb2.rgbGreen ||
			 rgb1.rgbBlue  != rgb2.rgbBlue )
			{
			Debug( "OS readonly compare with OS writable; entry %d (%d,%d,%d) (%d,%d,%d)\n", i,
				rgb1.rgbRed, rgb1.rgbGreen, rgb1.rgbBlue,
				rgb2.rgbRed, rgb2.rgbGreen, rgb2.rgbBlue );
//			break;
			}
		}
	}

// Compare the WRITABLE offscreen with a passed DIB
if ( (pdibw = lpOffScreen->GetWritableDIB()) && pdib )
	{
	RGBQUAD FAR *lpQuad = pdib->GetColors();
	RGBQUAD FAR *lpwQuad = pdibw->GetColors();
	for ( i=0; i<256; i++ )
		{
		rgb1 = lpwQuad[i];
		rgb2 = lpQuad[i];
		if ( rgb1.rgbRed   != rgb2.rgbRed	||
			 rgb1.rgbGreen != rgb2.rgbGreen ||
			 rgb1.rgbBlue  != rgb2.rgbBlue )
			{
			Debug( "OS writable compare with passed dib; entry %d (%d,%d,%d) (%d,%d,%d)\n", i,
				rgb1.rgbRed, rgb1.rgbGreen, rgb1.rgbBlue,
				rgb2.rgbRed, rgb2.rgbGreen, rgb2.rgbBlue );
//			break;
			}
		}
	}

// See if the WRITABLE offscreen is set to indices
if ( pdibw = lpOffScreen->GetWritableDIB() )
	{
	lpIndices = (LPWORD)pdibw->GetColors();
	for ( i=0; i<256; i++ )
		{
		if ( lpIndices[i] != (WORD)i )
			{
//			Debug( "OS writable not indices; entry %d (%d)\n", i, lpIndices[i] );
//			break;
			}
		}
	}

// See if the READONLY offscreen is set to indices
if ( pdibr = lpOffScreen->GetReadOnlyDIB() )
	{
	lpIndices = (LPWORD)pdibr->GetColors();
	for ( i=0; i<256; i++ )
		{
		if ( lpIndices[i] != (WORD)i )
			{
//			Debug( "OS readonly not indices; entry %d (%d)\n", i, lpIndices[i] );
//			break;
			}
		}
	}

#endif
}
Example #5
0
LOCAL void Story_OnDraw(HWND hWindow, HDC hDC, LPRECT lpRect, BOOL fHighlight)
/***********************************************************************/
{
	BOOL bHasFocus, bSelected, bDown;
	DWORD dwStyle;
	RECT rSrcArea, rDstArea;
	POINT ptDst;
	PDIB pdibSrc, pdibDst, pDib;
	LPOFFSCREEN lpOffScreen;
	PTOON pToon;
	LPSCENE lpScene;
	PSTORY pStory;
	RGBQUAD rgbQuad[256];
	BITMAPINFOHEADER bmi;
	LPTR lp;
	HDC hWinGDC;
	HPALETTE hWinGPal = NULL, hDisplayPal = NULL, hOldPal;

	if (IsRectEmpty(lpRect))
		return;
	pStory = GetStory(hWindow);
	if (!pStory)
		return;
	if (!pStory->m_pDib)
		return;
	lpScene = CScene::GetScene(GetParent(hWindow));
	if (!lpScene)
		return;

	rSrcArea = *lpRect;
	rDstArea = *lpRect;
	bSelected = GetWindowWord(hWindow, GWW_STATE );
	dwStyle = GetWindowLong( hWindow, GWL_STYLE );
	bHasFocus = ( GetFocus() == hWindow );
	bDown = ( bSelected || (bTrack && bInRect && bHasFocus) );

	lpOffScreen = lpScene->GetOffScreen();
	if (lpOffScreen)
	{
		MapWindowPoints( hWindow, GetParent(hWindow), (LPPOINT)&rDstArea, 2 );
 		if ( !(pdibSrc = lpOffScreen->GetReadOnlyDIB()) )
			return;
		if ( !(pdibDst = lpOffScreen->GetWritableDIB()) )
			return;
		hWinGDC = lpOffScreen->GetDC();
		hWinGPal = hDisplayPal = GetApp()->m_hPal;
	}
	else
	{
		// fix
		HWND hToon = FindClassDescendent(GetParent(hWindow), "toon");
		if (!hToon)
			return;
		pToon = GetToon(hToon);
		if (!pToon)
			return;
		MapWindowPoints( hWindow, pToon->GetWindow(), (LPPOINT)&rDstArea, 2 );
		pdibSrc = pToon->GetStageDib();
		lp = ToonGetDIBPointer(pToon->GetToonHandle(), &bmi);
		ToonGetColors(pToon->GetToonHandle(), 0, 256, rgbQuad);
		bmi.biClrUsed = 256;
		pdibDst = new CDib(&bmi, rgbQuad, lp);
		if (!pdibDst)
			return;
		hWinGDC = ToonDC(pToon->GetToonHandle());
		// to make sure we don't change the system palette
		hDisplayPal = CopySystemPalette();
		// to match WinG dib
		hWinGPal = CreateCustomPalette(rgbQuad, 256);
	}

	if (!pStory->m_fMappedToPalette && ((dwStyle & BS_MASK) == 0))
	{
		pStory->m_pDib->MapToPalette(hWinGPal);
		pStory->m_fMappedToPalette = TRUE;
	}


	// Copy source dib so we can twiddle its bits
	pDib = new CDib();
	if (!pDib)
	{
		if (!lpOffScreen && hDisplayPal)
			DeleteObject(hDisplayPal);
		if (!lpOffScreen && hWinGPal)
			DeleteObject(hWinGPal);
		return;
	}
	if (!pDib->Create(pStory->m_pDib->GetBitCount(),
						lpRect->right-lpRect->left,
						lpRect->bottom-lpRect->top))
	{
		delete pDib;
		if (!lpOffScreen && hDisplayPal)
			DeleteObject(hDisplayPal);
		if (!lpOffScreen && hWinGPal)
			DeleteObject(hWinGPal);
		return;
	}
	pDib->CopyColorTable(pStory->m_pDib);
	// draw in source bitmap
	pStory->m_pDib->DibBlt( pDib,
					0, 0,
				 	rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top,
				 	rSrcArea.left, rSrcArea.top,
				 	rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top,
				 	NO /*bTransparent*/ );
	
	if ( pdibSrc->GetCompression() == BI_RLE8 ||
		 pdibDst->GetCompression() == BI_RLE8)
	{ // compressed DIBs must use GDI copying (lose transparency ability)
		pdibSrc->DCBlt( hWinGDC,
						rDstArea.left, rDstArea.top,
					 	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
						rDstArea.left, rDstArea.top,
					 	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top );
	}
	else
	{
		pdibSrc->DibBlt( pdibDst,
						rDstArea.left, rDstArea.top,
					 	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
					 	rDstArea.left, rDstArea.top,
					 	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
					 	NO /*bTransparent*/ );
	}

	if ( pDib->GetCompression() == BI_RLE8 ||
		 pdibDst->GetCompression() == BI_RLE8 )
	{ // compressed DIBs must use GDI copying (lose transparency ability)
		pDib->DCBlt( hWinGDC,
					rDstArea.left, rDstArea.top,
					rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
					rSrcArea.left, rSrcArea.top,
					rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top );
	}
	else
	{
		RGBTRIPLE rgb;
		LPRGBTRIPLE lpRGB = NULL;
		if (dwStyle & BS_MASK)
		{
			STRING szColor;
			GetWindowText(hWindow, szColor, sizeof(szColor));
			AsciiRGB( szColor, &rgb );
			if (fHighlight)
			{
				// this relies on the fact that AsciiRGB replaces commas
				// with NULL terminators
				LPTSTR lp = szColor + lstrlen(szColor) + 1; // passed red
				lp += lstrlen(lp) + 1; // passed green
				lp += lstrlen(lp) + 1; // passed blue to higlight color
				AsciiRGB(lp, &rgb);
				rgb.rgbtRed = rgb.rgbtGreen = 0; rgb.rgbtBlue = 255;
			}
			else
				rgb.rgbtRed = rgb.rgbtGreen = rgb.rgbtBlue = 0;
			lpRGB = &rgb;
		}
		else
		{
			BYTE bTrans = *pStory->m_pDib->GetXY(0, 0);
			LPTR lpColor = pStory->m_pDib->GetXY(1, 0);
			LPTR lpHighlight = pStory->m_pDib->GetXY(2, 0); 
			BYTE bColor = *lpColor;
			BYTE bHighlight = *lpHighlight;
			// if highlight color is the transparent color then
			// we are hiding and showing highlighted area
			// if not, then we are changing the color of highlighted area
			if (bHighlight == bTrans)
			{
				// we need to strip off highlight info if we are not
				// highlighted
				if (!fHighlight && (bColor != bTrans))
				{
					HPTR hp = pDib->GetPtr();
					DWORD dwSize = pDib->GetSizeImage();
					while (dwSize)
					{
						if (*hp != bColor)
							*hp = bTrans;
						++hp;
						--dwSize;
					}
				}
			}
			else
			{
				// we need to change the color if we are highlighted
				if (fHighlight && (bColor != bHighlight) && (bColor != bTrans))
				{
					HPTR hp = pDib->GetPtr();
					DWORD dwSize = pDib->GetSizeImage();
					while (dwSize)
					{
						if (*hp == bColor)
							*hp = bHighlight;
						++hp;
						--dwSize;
					}
				}
			}
		}
		pDib->DibBlt( pdibDst,
					rDstArea.left, rDstArea.top,
					rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
					0, 0,
					rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top,
					YES/*bTransparent*/, lpRGB, NULL, hWinGPal );
	}
	delete pDib;

	ptDst.x = rSrcArea.left;
	ptDst.y = rSrcArea.top;
	if (lpOffScreen)
	{
		lpOffScreen->DrawRect( hDC, &rDstArea, &ptDst );
	}
	else
	{
		//if (hDisplayPal)
		//{
		//	hOldPal = SelectPalette(hDC, hDisplayPal, FALSE);
		//	RealizePalette(hDC);
		//}
		//pdibDst->DCBlt( hDC,
		//	ptDst.x, ptDst.y,
		//	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
		//	rDstArea.left, rDstArea.top,
		//	rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top );
		WinGStretchBlt( hDC,
			ptDst.x, ptDst.y,
			rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top,
			hWinGDC,
			rDstArea.left, rDstArea.top,
			rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top );
		//if (hDisplayPal)
	    //{
		//	SelectPalette(hDC, hOldPal, TRUE);
	   	//	DeleteObject(hDisplayPal);
		//}
		if (hWinGPal)
			DeleteObject(hWinGPal);
	}
}