| Repost: Create a Bitmap from a Device and pass that bitmap to C# |
|
 |
|
 |
|
 |
|
 |
Group: microsoft.public.win32.programmer.directx.graphics · Group Profile
Author: Allan MichaelsAllan Michaels Date: Dec 6, 2007 11:52
Hello all,
[Sorry for the repost. My IT dept. let my MSDN sub. lapse, and I posted
before my managed newsgroups email address was re-registered with my sub.]
The main app is in C#.
The DirectX code is in C++ (ported from Managed DirectX).
I've written all the code so that C++ creates the device, vertices, and
indexes then renders perfectly.
I need to get a bitmap from the device and return the bitmap (or a pointer
to the bitmap) back to the C# code.
This is to replace the following Managed DirectX code:
backbuffer = m_oDevice.GetBackBuffer(0, 0, BackBufferType.Mono);
GraphicsStream gs =
SurfaceLoader.SaveToStream(ImageFileFormat.Bmp,backbuffer);
Bitmap bmpTemp = new Bitmap(gs,false);
I've worked with D3DXSaveSurfaceToFileInMemory(...) to return a handle to a
bitmap.
I returned that pointer to the C# function and used it in
Image img = Image.FromHbitmap(...);
But that threw an exception.
Understanding that this is a bitmap *file* in memory, I indexed past the
FILEHEADER and returned that pointer to C# and used FromHBitmap().
But that threw an exception.
I indexed past the INFOHEADER and returned that pointer to C# and used
FromHBitmap().
But that threw an exception.
How do I get and return a bitmap type that is useful in C#/.NET????
Thank you in advance for your kind help.
--
Allan Michaels
Ann Arbor, MI
|