BMP format - description of the Windows graphic format.

Depth #02
Mysic by: ALOS(JNR)/SPARK               
                                        
Format description BMP for   
 Window 3.0 (DIB)        
__________________________________________
                                        
                                        
 The main difference between the new file format
(DIB) - Device Independent Bitmap (appa-
A value-independent bit image) is
The only thing is that they use encoding
colors with one bit plane.      
                                        
 new format bitmap files
start with structure
BITMAPFILEHEADER:                       
                                        
   typedef struct tag BITMAPFILEHEADER  
                                        
word bfType: file type  (for bitmap - BM)
 dword bfSize; //file size in dword      
word bfReserved1: not used                           
word bfReserved2: not used                           
dword bfOffbits: offset of the bit image data from the
                  dexterity in bytes                            
                                                            
                                                            
Directly behind it is structure BITMAPINFO , co- держащая всю ин- формацию о бито- вом образе. Она делится на две части: структуру BITMAPINFOHEADER , описывающей размеры и цвето- вой формат бито- вого образа, и массив структур RGBQUAD ,опреде- ляющей цветовую палитру:
typedef struct tag BITMAPINFO; BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors [1]; typedef struct tag BITMAPINFOHEADER dword biSize: число байт , занимаемых структурой BITMAPIUFOHEADER dword biWidth: ширина битового образа в пикселах dword biHeight: высота битового образа в пикселах word biPlames: число битовых плоскостей устройства word biBitCovmt: число битов на пиксель dword biCompressiom: тип сжатияdword biSizeImage: image size in bytes dword biXPelsPerMeter: horizontal resolution of the device, pixel/m dword biYPelPerMeter: vertical resolution of the device, pixel/m dword biClrUsed: number of colors used dword biClrImportamt: numberof "important" colors BITMAPINFOHEADER More details biSize - usually used for easier access to the color table. biPlanes - defines the number of bits planes; however, since the color code arranged by successive bits, this the number is always equal to 1. biBitCount - this field is determined number of colors used by the bitmap zom. Depending on the coding method niya, can take the following values: 1 - the bit image is monochrome, and the color table must contain two elements cop. Each bit in the data array is coded one pixel is removed. If the bit value is 0 , then the pixel becomes the first color tables; if - 1, the pixel becomes second color of the table. 4 - the bit image has a maximum 16 colors, and an arraybmiColors (color table Comrade) has up to 16 elements. Coloreveryone pixel is determined by the color table using a four-bit index. Nap- example, if the first byte of data has valueZAh, then when displaying bit- th image, the color of the first pixel determines This is the fourth element of the color table, and the color of the second is eleventh. 8 - the bit image has a maximum 256 colors, and the color table has up to256 elements. Each byte of the data array determines the color of one pixel. 24 - the bit image has a maximum of 2 in 24th color degree. Color Chart is empty, and the color of the pixels is determined by the kets of three bytes describing the colors commercial intensities of red, green and blue colors. biCompression - compression type. Maybe take values: BI_RGB - no compression; BI_RLE8 - compression for format 8 bit to pixel; BI_RLECH - compression for format 4 bits to pixel biXPelsPerMeter and biYPelsPerMeter - can be used to select from a list of resource pictograms, the most suitable for this device. biClrUsed - number of colors used data in a bitwise manner. If 0, then all colors of the palette are used (specified- nes in the bmiColors array). biClrImportant - used for control the color display algorithm Comrade So, if four different applications tions are displayed on the screen one bit at a time different image with 75 colors each, then adapter that outputs 256colors simultaneously Of course, it won’t be able to be completely authentic display all 4 pictures on the screen. B In this case, a replacement mechanism is used colors - the bit image with the most lower priority and its "extra" colors are replaced by the most suitable ones. typedef struct tagRGBQUAD byte rgbRed: intensity red byte rgbGreen: intensity green byte rgbBlue: intensity blue byte rgbRserved: not used RGBQUAD After all parameters are bit- of the image are defined, the file contains the mi scan lines of the bit plane, and the first scan line in the format DIB is considered the bottom scan line is (i.e. the beginning of the typedef struct tagRGBQUAD byte rgbRed: intensity red byte rgbGreen: intensity green byte rgbBlue: intensity blue byte rgbRserved: not used RGBQUAD After all parameters are bit- of the image are defined, the file contains the mi scan lines of the bit plane, and first scan linein the format DIB read the bottom scan line is (i.e. the beginning of the the ordinate is in the lower left corner images). Scan lines are aligned to 32-bit border - dword !!! __________________________________________

Share your thoughts about the article