unmanaged memory to managed Bitmap

bwells

Regular
Joined
Feb 25, 2003
Messages
84
I have a program which reads raw image data from audio hardware. I am reading the data in unmanaged C++ code. In a managed C++ routine, I have a pointer to an unmanaged unsigned char array.

I would like to load a bitmap object with this data so I can display the data by calling the DrawImage method on a Graphics object.

How can I transfer an unmnaged 512x1024 unsigned char array into a managed Bitmap object for display? If I dump this memory into a "raw" binary file, I can load the file into Photoshop as an interleaved raw format file, so untimately, I want to see the same image on my form.


thanks
Bryan
 
One of the bitmap constructors wraps the GdipCreateBitmapFromScan0 function. So you can pass the address of your bitmap and the other required information to create a bitmap object.
 
Back
Top