ifstream in("test.wad", ios::binary | ios::nocreate);
in.read((UCHAR*) &bitmap.bitmapfileheader, sizeof(BITMAPFILEHEADER));
in.read((UCHAR*) &bitmap.bitmapinfoheader, sizeof(BITMAPINFOHEADER));
if(bitmap.bitmapinfoheader.biBitCount == 8)
in.read((UCHAR*) &bitmap.pallette, sizeof(PALLETTEENTRY));
in.read((UCHAR*) &bitmap.buffer, sizeof(bitmap.bitmapinfoheader.biOffBits));
Looks great right? Well it works if all the prog does is read it in, initialize the wad, and then spit it back out with a new file name! Unfortunatley, I need to load it into one of the GDI''s BITMAP structs. The function I think I need to use is CreateDIBitmap(). I dont have MSDN in front of me or I would put the parameter list up here. Reading in a BITMAPFILEHEADER, a BITMAPINFOHEADER, maybe a PALLETTEENTRY, and the bitmap data is great, except that I need to have a BITMAPINFO struct too. I looked in this struct and it has some wierd shit like RGBQUAD or some BS. I don''t know where this struct is supposed to come from (or better yet, how I can create one), but my format works for the bitmaps that come with windows so what should I do?? What format should I use, or what function should I use to get these (Device Independant?) bitmaps into the GDI bitmap format?
Bitmap File Compatibility
Grr... back at it with the bitmaps!! I need to read in bitmap files from a .wad file that I made, then load them into a memory device context, and then bitblt() them to the screen. The code I used to load them into (and out of) the .wad file looks something like this:
There is no spoon.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement