.bmp file loading is impossible

Started by
11 comments, last by KwamiMatrix 22 years, 10 months ago
quote:Original post by dwarfsoft
I wrote a BMP loader that was DDraw intependant. I then had a char * to DDSurface function that did the specific changes. The only problems that I ever had were when the bitmaps width where not to the base 2 (ie were not 16,32,64,128 etc). When that happened there where some impossibly strange Skewing problems that seemed to defy logic.

Has somebody had this problem, because no amount of hacking code has ever gotten me closer to figuring out why this happens.


It''s a rather simple problem. Not always that evident if you don''t know about it, but very easy to solve. To put it straight, all scanlines in the bitmap are dword aligned. End of story, problem fixed

"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album
Advertisement
This topic hits close to home.

I was writig my image classes recently, and GDI was fidling with my 8bit file colours, so i switched BitBlt to memcpy to fix that, but then GDI on Win2K was doing the weird skewing thingie.

Turns out (after muchos debugging), strange thing is GDI wasn''t handling the DWORD padding properly on Win2K, but it was on Win98SE. I got so fed up up with it I wrote my own BMP loader class that uses fopen().

Works great, and can load weird sized BMP''s (e.g. 127 pixels wide), of any colour depth.

It''s a last-ditch solution, but it''s the most educational, flexible, and IMHO best.

Now....to fix the BMP file format so it''s less stupid.
(Custom file formats anyone?) :D
Right....not inverted
Colour components not reversed
Kill any irrelevent header info
The list goes on....


Waassaap!!
Waassaap!!
quote:Original post by mr_jrt

Now....to fix the BMP file format so it's less stupid.
(Custom file formats anyone?) :D
Right....not inverted
Colour components not reversed
Kill any irrelevent header info
The list goes on....

I just made my engine expect ALL textures to be inverted, it's easier than flipping the inverted targas and bitmaps I'm loading (I forgot to bring that up, but my bitmap code doesn't flip it, since my engine likes its inverted textures ).

[EDIT: Third edit, hopefully my grammar is finally fixed]

[Resist Windows XP's Invasive Production Activation Technology!]

Edited by - Null and Void on June 22, 2001 7:18:09 AM

This topic is closed to new replies.

Advertisement