Archived

This topic is now archived and is closed to further replies.

Badone

Saving Images

Recommended Posts

Badone    122
I''ve been looking through msdn for a while and searching online but haven''t found anything yet. I''m trying to make a tile ripper for the game that I''m working on so the artists that have made the worlds don''t have to manually make them into tiles. I''m going to use rects I guess and copy the tiles from a lot of maps to a single surface. What I''m wondering though, is how do I save a surface to a bitmap file? I know you can sure load bitmaps from a lot of different ways, but how do you save them? Thanks.

Share this post


Link to post
Share on other sites
KalvinB    102
http://therabbithole.redback.inficad.com/tricks/downloads/screenshot.cpp

It uses DirectX 7. Switching it to any version is easy.

Ben

Share this post


Link to post
Share on other sites
Badone    122
Ok, I got it working by doing this, if anyone else needed to do something like this:

g_pDevice->CreateImageSurface(800, 600, D3DFMT_A8R8G8B8, &g_pSurface);
g_pDevice->GetFrontBuffer(g_pSurface);
D3DXSaveSurfaceToFile("screenshot.bmp",D3DXIFF_BMP,g_pSurface,NULL,NULL);

Share this post


Link to post
Share on other sites