Help creating a Bitmap
I need help to create a Bitmap picture.
The situation is like this:
I am loading in an array with 16 bit values. Each of these values represent the color of one pixel. Each array represents one line of a bitmap image. And then I loop the program so that in the end, a whole picture is created on the screen.
My problem is, what kind of API functions can I use to do this?
I have looked at SetPixel() and Bitmap constructor, but I don't understand the whole process.
Can anyone give me some tips?
I'm using C++ in MFC.
Hoping for a reply
If you load the array into memory, you can draw it to the screen using StretchDIBits. You'll need to fill out the BITMAPINFOHEADER of a BITMAPINFO structure first, specifying the size of the BITMAPINFOHEADER structure, width and height (Negative height if the array stores the top line first and the bottom line last), 1 plane, 16 bit count and zeroing the other members.
Once that's done, you can call:-
StretchDIBits(hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, lpBits, &bi, DIB_RGB_COLORS, SRCCOPY);