Sign in to follow this  
EODCyismARDEM

framebuffer to bitmap file

Recommended Posts

I am using Lock on a DirectDraw front buffer to draw pixels to the screen. I need to capture a screenshot and write it to a file. I have tried to configure directx to capture the screen when prntscrn is pressed but it doesn't work (maybe because I'm writing directly to the front buffer??) So i have a pointer to an array of size 640x480, with 24 bit pixels. All I need to do is write this to a bitmap. When I try to google an answer I get stuff that deals with DC GDI stuff, and say"all you need is a DC context or something" Well i'm not familiar at all with gdi stuff and I have trouble if I try to implement this stuff. Can somebody please help me out with this.

Share this post


Link to post
Share on other sites
Thanks alot Smack0007, GetDC was exactly what I needed.

For people that possibly search this post in the future, This page: http://www.geocities.com/foetsch/screenshot/screenshot.htm solved my problem. It has a code listing on the bottom that takes a screenshot from a directdraw buffer.

Nurgle: I write to a backbuffer but then bitblt to the front, rather than flip. Thats what I meant by writing to the frontbuffer, I guess I was a little misleading.

Share this post


Link to post
Share on other sites
Hmmm... I think you really want to flip instead of blit... (I'm a poet and I wasn't aware of the fact)



Technically, blitting is just changing the starting address of the video buffer, where as blitting involves copying the memory, ergo, flip=faster. I'm not sure if modern cards still do this, but that's how it used to be in the good ol' days of Mode 13H.

Share this post


Link to post
Share on other sites

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