Original Post
Ok. One more bitmap file format question. I can load everything in fine (including loading in the palette). However, I am having trouble loading in 16 color images. In a 256 color image I do this:
The 0x436 is the data offset in a 256 color image. This is because the palette starts at 0x36 (54 bytes into the file). There are 4 bytes per color, so 54 + (4 * 256) = 1078 = 0x436. And this all works fine. So I figured I could do this to load a 16 color image:
I cut the image size in half because there are 4 bits per pixel so two pixels can fit in a byte. And the 0x64 is because 54 + (4 * 16) = 118 = 0x64. However, this doesn''t seem to work. Can anyone help?
fseek(pFileIn, 0x436, SEEK_SET);
for(int i = 0; i < imageSize; i++)
{
imageData[i] = fgetc(pFileIn);
}
for(i = 0; i < imageSize; i++)
{
cout << imageData[i] << ", ";
}
imageSize = imageSize / 2;
fseek(pFileIn, 0x64, SEEK_SET);
for(int i = 0; i < imageSize; i++);
{
imageData[i] = fgetc(pFileIn);
}
for(i = 0; i < imageSize; i++)
{
cout << (imageData[i] & 0xF) << ", ";
cout << ((imageData[i] >> 4) & 0xF) << ", ";
}