Hello,
the big advantage of a raw bmp file compared to jpeg is its great simplicity, especially with 24bit colors as in this case a color-table isn't needed. The whole file-format thus only consists of two simple header structures followed directly by the raw 24bit pixeldata.
BitmapFileHeaderBitmapInfoHeaderYou can also assume that the image-data in the bitmap isn't compressed but only consists of RGB triplets which each represent a pixel. For some reason the image is stored bottom-up, that means that the first pixel is in the lower left corner and that the last pixel is in the upper right corner.
5 -> 6 -> 7 -> 8
1 -> 2 -> 3 -> 4
Apart from that each scan-line is aligned to a 32bit boundary which means that a padding is added if [pixels_per_line*24bits)%32bits != 0]. As you know the scanline lenght from the headers it's no big deal to calculate where the next line start. Assuming that you have set your display adapter to a 24bit mode all you have to do in order to display the image is to copy the data bottom-up and with respect the the padding to the linear frame-buffer.
Code:
xres = infoheader.biWidth;
yres = biWidth.biHeight;
p_rgb_data = bitmap_location + fileheader.bfOffBits;
p_framebuffer = 0x12345678;
for(i=yres; i>0; i--)
{
for(j=0; j<xres; j++)
{
p_framebuffer[i*xres*3 + j*3 + 0] = &p_rgd_data; // red
p_rgd_data++;
p_framebuffer[i*xres*3 + j*3 + 1] = &p_rgd_data; // green
p_rgd_data++;
p_framebuffer[i*xres*3 + j*3 + 2] = &p_rgd_data; // blue
p_rgd_data++;
}
; jump over the padding at the end of the scanline
if(p_rgd_data%4 != 0)
{
p_rgd_data += (4 - p_rgd_data%4)
}
}
This is just some pseudo-code and as I haven't tested it you shouldn't be too surpised if it contains some bugs
regards,
gaf