G
Guest
Hey. I've got a color photo in a simple unsigned charRGB array. The photo
does not exist on disk. I want to display the photo in my window.
The application I am working in (not my choice) demands that I draw into the
display by first creating a Bitmap, and then drawing into a DisplayContext
using BitBlt(). The pseudocode looks something like:
// Create an empty bitmap:
HDC hScreen = GetDC (0);
pHandle = CreateCompatibleBitmap (hScreen, width, height);
// Here is the problem: How do I copy my photo into the bitmap
// at this point??
// .... TBS .... magic here ....
// Now write the bitmap into the display:
HDC hdcMemory = CreateCompatibleDC ((HDC)pSystemContext);
hOldObj = SelectObject (hdcMemory, pHandle);
BitBlt ((HDC)pSystemContext, ....(HDC)hdcMemory, ..., SRCCOPY);
My question is: How do I transfer the pixels from my photo in memory
(unsigned char array) into the Bitmap? I understand that the bitmap
type - by design - is very opaque and I dont expect to have direct access to
the innards. But surely there must be some function call that will take an
RGB array of pixels and put it into the bitmap?
Thanks in advance for any help,
neal
does not exist on disk. I want to display the photo in my window.
The application I am working in (not my choice) demands that I draw into the
display by first creating a Bitmap, and then drawing into a DisplayContext
using BitBlt(). The pseudocode looks something like:
// Create an empty bitmap:
HDC hScreen = GetDC (0);
pHandle = CreateCompatibleBitmap (hScreen, width, height);
// Here is the problem: How do I copy my photo into the bitmap
// at this point??
// .... TBS .... magic here ....
// Now write the bitmap into the display:
HDC hdcMemory = CreateCompatibleDC ((HDC)pSystemContext);
hOldObj = SelectObject (hdcMemory, pHandle);
BitBlt ((HDC)pSystemContext, ....(HDC)hdcMemory, ..., SRCCOPY);
My question is: How do I transfer the pixels from my photo in memory
(unsigned char array) into the Bitmap? I understand that the bitmap
type - by design - is very opaque and I dont expect to have direct access to
the innards. But surely there must be some function call that will take an
RGB array of pixels and put it into the bitmap?
Thanks in advance for any help,
neal