Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

Printing from Direct3D textures...

This topic is 4967 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I didn't know whether this was better off in General Programming but since Direct3D textures are involved I thought I had better stick it here. I need to be able to to send Direct3D textures to the printer under Windows Xp and 98.. Is this possible? I did some looking around and it seems that most of the printing articles refer to GDI BITMAP objects, but I would rather avoid any extra overhead as this part of the code is already stretched thin with regards to performance. Thanks in advance for any advice or pointers. Kind regards. Mark Coleman

Share this post


Link to post
Share on other sites
Advertisement
Quote:
it seems that most of the printing articles refer to GDI BITMAP objects
Unfortunately I don't have any precise code for you... but one idea I'd definitely look into is the "GetDC()" function of either IDirect3DTexture9 or IDirect3DSurface9 (forget which one has it)... You can definitely get a 'DC' for your texture, and then you should be able to follow the other information you have on sending it to a printer.

As for performance, short of sending it straight to the printer driver and avoiding GDI/Win32 stuff I don't think you'll find anything much faster than what I mentioned above.

hth
Jack

Share this post


Link to post
Share on other sites
I've never done printing myself, but after a quick glance, it appears that functions such as StartPage() take a device context handle. To get the HDC from a texture, all you need to do is call pTexture->GetSurfaceLevel(0, &pSurface); and pSurface->GetDC(&hDC);. Call pSurface->ReleaseDC(hDC); and pSurface->Release(); afterwards, of course.

Hopefully this'll work for you.

[edit]Me == Slow[/edit]

Share this post


Link to post
Share on other sites
Looking a bit closer than previously, it appears that you're correct. StartPage() apparently tells Windows that you're using the specified DC as the destination. Then you get the DC from the DX surface, and use blit functions to copy from the DX DC to the DC given to StartPage(). If you haven't already found it, here is one of Microsoft's pages on printing with DCs, part of MSDN's overal Win32 Reference.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!