This is a problem that I have not seen addressed anywhere.
Any help would be appreciated.
Thanks,
Mark
I think you may be able to do it like this. First, get the surface onto
which
you are rendering with the GetRenderTarget method of the D3D device
(call it
pSurf). You can then blit the image from that surface onto a Windows
bitmap
using good old GDI. Pseudo-code follows:
HDC hdcFrom = NULL;
pSurf->GetDC(&hdcFrom);
// Create a Windows bitmap and select it into a
// memory device context
HDC hdcMem = ::CreateCompatibleDC(hdcFrom);
HBITMAP hbm = ::CreateCompatibleBitmap(hdcMem, sizex, sizey);
HBITMAP hbmOld = ::SelectObject(hdcMem, hbm);
// Blit the image from the rendering surface onto
// the Windows bitmap
::BitBlt(hdcMem, 0, 0, sizex, sizey, hdcFrom, 0, 0, SRCCOPY);
// Now we've got the rendered image in 'hbm' - clean up
pSurf->ReleaseDC(hdcFrom);
::SelectObject(hdcMem, hbmOld);
::DeleteDC(hdcMem);
Finally, MSDN contains sample code that shows how to output the Windows
bitmap
'hbm' onto a printer. Note that I haven't actually tried this so I don't
guarantee it works :)
Regards,
Sami
this is indeed how you do it. i simply get the dc and save the bitmap then
in my OnPrint function (i'm using MFC which makes things easier) just blit
the bitmap to the printer dc.
cheers, olly.