bltbit???

raymondpgi
raymondpgi used Ask the Experts™
on
im able to display a bitmap using a dialog box. the problem that i have is how to divide the bitmap into 8x8 pixels. it would be displayed 8x8 pixels at a time. the code i used to display the bitmap is this:

void CDibView::OnDraw(CDC* pDC)
{
    CDibDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    CPalette* pPal = pDoc->GetPalette();
    CPalette* pOldPal = pDC->SelectPalette( pPal, FALSE );
    pDC->RealizePalette();
    CDIBitmap* pBmp = pDoc->GetBitmap();
    pBmp->DrawDIB( pDC, 0, 0 );
    pDC->SelectPalette( pOldPal, FALSE );
}
im trying to insert here the bitblt but errors occured. am i right that i should insert it on the cdibview::ondraw class?
is there any commands that would be more simple than bitblt? can you give a guide on how to use it
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
try looking at MFC examples on CreateCompatibleDC.

Basically you create a DC in memory compatible with your document DC.  Load the whole bitmap into the memory DC and then use BitBlt to copy a rectangular area of the memory DC into the document DC:

CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CDC memDC;

memDC.CreateCompatibleDC(pDC);

// select the correct bitmap
CBitmap* pOld;
pOld = memDC.SelectObject(&m_Bitmap);

// and copy the bitmap in
pDC->BitBlt(iToX, iToY, iWidth, iHeight, &memDC, iFromX, iFromY, SRCCOPY);
memDC.SelectObject(pOld);


cheers



chrubb

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial