Link to home
Start Free TrialLog in
Avatar of cw43
cw43

asked on

Load a 2D array of intensity into a CBitmap object

Say I have a 100x100 unsigned char array with intensities from 0~255, and I would like to display it via a CBitmap object on a CView class.  How do I pass this array into a CBitmap object to be able to display it?  
Avatar of jhance
jhance

Use the CBitmap::SetBitmapBits() member function.
Avatar of cw43

ASKER

I have tried SetBitmapBits() after my CBitmap::CreateBitmap() function.  It does not work, nothing shown on the screen.  However, LoadBitmap() simply works.
CBitmap is a device dependent bitmap, which means its bits information depends on the display card and the display driver. You can set the bitmap bits correctly if it is monochrome (0 & 1). Otherwise you need to use a DIB.
ASKER CERTIFIED SOLUTION
Avatar of galkin
galkin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial