Hello,
I am making a program that deals with bitmap files and I want to try to load bitmap data manually. The issue is that I cannot find a good resource for exactly what bitmap files can contain. Wikipedia has a decent article, but it is missing some important information. For example, it only explains how BITMAPINFOHEADERs work, but I would need to know how all of them work. Also the examples on wikipedia show integers stored in a sort of interleaved-endianness... I am wondering if normal c-style stdio file io would accurately read these values. Basically I just need a bit of help filling out this class:
class BitmapImage
{
struct{
unsigned short headerField :16;
unsigned int fileSize :32;
unsigned short reserved1 :16;
unsigned short reserved2 :16;
unsigned int startAddress :32;
}BitmapFileHeader;
struct{
//probably a union of the different possible header structs???
}DIBHeader;
struct{
}ExtraBitMasks;
struct{
}ColourTable;
unsigned int gap1,gap2;
struct{
}PixelArray;
struct{
}ICCColourProfile;
public:
void LoadBMP(FILE*);
void SaveBMP(FILE*);
int width();
int height();
unsigned int &operator()(int x, int y);//pixel access
unsigned int alphaMask();
unsigned int redMask();
unsigned int greenMask();
unsigned int blueMask();
unsigned int bpp();
};
Thanks.