I can confirm from doing this myself, that the different version are pretty much the same except for the header size.
You can just copy and paste the struct version you need header you want from here
https://msdn.microsoft.com/en-us/...esktop/dd183386%28v=vs.85%29.aspx
and remove the size (DWORD bV4Size;)
then create the bmpfileheader stucture
| struct __attribute__(__packed__)) bmpFileHeader
{
char sign[2];
uint32 size;
unsigned short resv1;
usingned short resv2;
uint32 bitmapOffset;
};
|
then read the file header
| unsigned char fileheader[sizeof...
bmpfile = fopen....
fread(fileheader,sizeof(struct bmpFileheader),1,bmpfile)
|
then read and get the size
| fread(headerDump,sizeof(uint32),1,bmpFile);
hsize =(uint32) headerDump;
|
then you check the header size to see what version you need to work with.
| if (*hsize == 128-4) //128 bits BMPVersion 5 (minus 4 because we took out the header size)
if (*hsize == 108-4) //108 bits BMPVersion 4 (minus 4 because we took out the header size...I think)
|
The rest you can follow on handmade hero past episode and is pretty much the same except if you don't have compression then you can skip the episode after he shows you how to do the basic rendering.
I hope this helps.
oops I forgot the mention that I'm doing this on a linux machine.