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

create a bitmap from DC

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

That''s a good question. The DDLoadBitmap() will load a bitmap into a DirectDraw surface. But you want to go the other way around-- Have a DirectDraw surface and create a (DIB) Bitmap from it.

To be honest, I don''t know if there is a really easy way to do it using any DirectDraw API calls.

To do it by hand, you need to read up on how to write a DIB bitmap. Then you would just write the contents of the DC or DirectDraw surface (a pixel at a time if necessary.) Preserving the DC''s pixel format is probably a bit tricky, esp with 15 or 16-bit graphic formats.


Share this post

Link to post
Share on other sites
1) Get a DC from your DDraw surface

2) Use CreateCompatibleDC() to create a DC compatible with your DDraw surface''s DC

3) Use CreateCompatibleBitmap() to create abitmap with the same properties as your surface.

4) Use SelectObject() to select the bitmap into your compatible DC.

5) Use BitBlt() to copy the contents of the DDraw surface''s DC into the new DC.

Share this post

Link to post
Share on other sites