Making a DDraw surface from bitmap data, help!

Started by
0 comments, last by ge0rge 22 years, 2 months ago
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.
Advertisement
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
DworD

This topic is closed to new replies.

Advertisement