Display 8bit image data in a window
Posted on 2006-07-21
I need to display some data in the View of an MFC application.
The data i have has come from a camera and is 8 bit data with each bit representing one grey scale pixel value.
I'm having problems display the data at the moment. With the code i have the image is the correct size but the image within it seems to repeat itself four times.
My current solution involves trying to create a CBitmap object out of the data using CreateCompatibleBitmap and SetBitmapBits.
I have very little experience of palettes and CBitmaps so any help would be appreciated.
This is the code I currently have in OnDraw: (pImage->GetData returns the raw data)
ImageData* pImage = pDoc->GetImage();
bitmap.CreateCompatibleBitmap(pDC, pImage->GetWidth(), pImage->GetHeight());
CBitmap* pOldBitmap = dcMem.SelectObject(&bitmap);
pDC->BitBlt(0, 0, pImage->GetWidth(), pImage->GetHeight(), &dcMem, 0, 0,SRCCOPY);
Maybe i need to do something with the palette?