I'm looking for a C library to load .BMP image-files.
I've found a lot of code on the net, but everything I've seen so far is useless for me.
Either the code seems to be in a good shape but it only supports just or two of the possible sub-formats, or the code supports all major sub-formats but does not error-checking and handling at all.
Does something with the quality of libPNG of libGIF exists for .BMP-files?
Another thing to add: I'm not looking for one of these "I load 80 different formats for you" wrapper-libraries like DevIL. Code-space and is important (it's for an embedded project).
EDIT:
Thanks to all those who've pointed me to wikipedia and the code that's linked from this page. Guys - I'm not an idiot. Of course I had a look at this code before I posted here, and I thought I made sure that THIS is one of these codes that I don't want.
Just to name some some of the defects that his code has:
Code does not check for out of memory conditions (okay - in C++ I can roll everything into a try-except block, but even this will leak memory because I - as a lib-user - don't know shit about the allocation-order. A self-contained piece of code should clean up it's mess after itself if it runs into trouble and reports failure, not raise some generic exeption.
Code assumes that fread always succeeds. Obviously the author never tried to read from a network-share or pipe.
Code thinks that because height can be negative (which in .bmp-slang means that the image is stored in top-down fashion and is well documented), that the same is true for the width as well. Exploit-city - I welcome you.
Code does not handle BI_RGB images with palettes (these are around in the wild). I have no problem using a lib that does not to handle these, but at lest the condition should be checked and returned as an error. Just returning garbage image-data is not an option. Palettes with less than 2^n entries are ignored either.
Don't get me started on RGB565; ARGB4444 coded images, .BMP-Files that serve as a container for .PNG or JFIF images and all the other thousand sub-formats. At least a lib should check if it does support a format and not blindly ignore data that it does not understand.
Seems like I have to develop my own code.. Thanks everyone.