Sign in to follow this  

Printing from Direct3D textures...

This topic is 4749 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
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

This topic is 4749 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this