[SDL] Loading image
Sam Lantinga
slouken at devolution.com
Fri Oct 4 23:28:01 PDT 2002
> Hi:
> How I can read an image that it's stored on a resource file *.rc in VC++
I had to look this one up. :)
It looks like you can load the image using the windows LoadBitmap() function.
Once you get an HBITMAP, you have to get at the BITMAP structure it references
and just copy the data to an SDL surface. It looks like you can use the
GetObject() function to get at the BITMAP structure:
HBITMAP hBmp = LoadBitmap(...);
BITMAP bmp;
// Retrieve the bitmap color format, width, and height.
GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp);
Then you'll need to get at the bits using GetDIBits() and an HDC created
using GetHDC(NULL) ....
Does anybody have code that does this (or a different approach)?
Here's some more information that might help:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_7zfp.asp
See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment
More information about the SDL
mailing list