Loading windows bitmaps

Started by
3 comments, last by KuztomX 23 years, 10 months ago
I know this may sound like a basic question, but I havent been able to get it right. Anyone have the way to load an 8 bit windows bitmap? Im not interested in RLE bitmaps. I try to use the code in Tricks of the Window Programming Game Gurus but that doesnt seem to work with bitmaps of dimensions other than 320x240. They come out skewed slightly. Any help would be much appreciated. By the way, I need a way to manually load the bitmap instead of using LoadImage because I need the palette info and direct access to the bits. Thanks!
Advertisement
Why not use GetDIBits() and GetPaletteEntries()? Both are GDI functions, and are used to retreive the acutal bits and the palette information. Use SetDIBits to set the bits in a bitmap. Use SetPaletteEntries to set the palette in a bitmap.
Actually, I would rather to avoid those functions as they need a handle to a device context, and the game library I am writing is not going to be too platform specific, so I want to avoid using windows variables when possible.

If i remember correctly, the bitmap size has to be a multiple of 8.. if you see the load bitmap code, you will see that assumption there, just remove it and it will work..
It has to have a DWORD aligned width, I believe. Meaning it has to have a multiple of 4 as it''s width.

This topic is closed to new replies.

Advertisement