Archived

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

ge0rge

Making a DDraw surface from bitmap data, help!

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.



DworD

Share this post


Link to post
Share on other sites