Jump to content
  • Advertisement


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


Making a DDraw surface from bitmap data, help!

This topic is 5990 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 need to create a directDraw surface from a char* array holding the bitmap data. Does anyone know how to do it, and maybe have code that does it? Because I''m loading from a compressed file I can''t use LoadImage or any of the functions that deal with files on the hard drive. I tried using CreateBitmap, but the surface comes out total garbage.

Share this post

Link to post
Share on other sites
Depends of the data If by data you mean raw pixel data like:
RGBRGBRGB... or (IIIIIIIII for indexed bitmap) then you almost have a directX surface. You just need extra padding to have your surface memory aligned (a 16 multiple). They call it pitch. So, you have to set the surface to the desired size (IE 320x240), lock it, get the pointer to the data, get the pitch, and copy your data using the right pitch.


Share this post

Link to post
Share on other sites

  • 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!