Reading Formats BMP
As we said, Format File was developed for universal cross-platform, so it is not surprising that the color palette is stored in it differently than assumed for VGA. During the procedure and read the necessary conversion. (That is the VGA palette and how to work with it, we will discuss in a future article.)
module to read 256 color Bmp-file has only two procedures. As can be seen from the listing, the procedure for opening the file must pass ReadBMP image sizes. This is useful if you want to read the picture is incomplete. When you know the size, it is not a problem, but it would be nice if using our module can be read any images, including those whose size is not known beforehand. To do this, a procedure for ReadBMPheader, only reads the file header. Calling it, you can check whether the image is recorded in the selected 256-color Formate, to know its size and then allocate memory for it and put in the allotted buffer.