DDB device-related lattice Map
Device-independent Dib lattice Map
. Gif and. JPEG formats are compressed.
The. Dib file format is from OS/2 (Version 1.1), and then in windows3.0
The OS/2 lattice format is used. This is called DiB.
The program can load the dib file minus the first 14 tuples into the continuous memory.
In this case, it is called a packed Dib format dot matrix.
DiB consists of four parts:
File Header, information header, RGB color table (not necessarily available), dot matrix element (data)
Packed Dib has no file header information
File Header structure bitmapfileheader
Typedef struct tagbitmapfileheader
{
Word bftype; // The type of the bitmap file, which must be BM.
DWORD bfsize; // the size of the bitmap file, in bytes.
Word bfreserved1; // reserved word of the bitmap file, which must be 0
Word bfreserved2; // reserved word of the bitmap file, which must be 0
DWORD bfoffbits; // the starting position of the bitmap data, relative to the bitmap
// The offset of the file header, in bytes
} Bitmapfileheader;
Word occupies two bytes, and DWORD occupies four bytes, so bitmapfileheader is 14 bytes.
0000-0001: File ID, which is the ASCII code "BM ".
0002-0005: file size.
0006-0009: Reserved. Each byte is set to "00.
000a-000d: records the starting position of the image data area. The meaning of each byte is as follows:
Size of the file header information block, size of the image description information block,
The size of the image color table (01 ).
Information header Structure
In OS/2, the bitmapfileheader structure follows the bitmapcoreheader structure.
In Windows, the bitmapfileheader structure follows the bitmapinfoheader structure.
Bitmapinfoheader and bitmapcoreheader are of the same nature, but in the operating system
Different structures are different.
Typedef struct tagbitmapinfoheader {
DWORD bisize; // number of bytes occupied by the structure
Long biwidth; // The bitmap width, in pixels.
Long biheight; // The height of the bitmap, in pixels
Word biplanes; // The level of the target device, which must be 1
Word bibitcount; // The number of digits required for each pixel, which must be 1 (two-color ),
// 4 (16 colors), 8 (256 colors), or 24 (true color)
DWORD bicompression; // bitmap compression type, which must be 0 (not compressed ),
// 1 (bi_rle8 compression type) or 2 (bi_rle4 compression type)
DWORD bisizeimage; // bitmap size, in bytes
Long bixpelspermeter; // horizontal bitmap resolution, number of workers per meter
Long biypelspermeter; // bitmap vertical resolution, number of bytes per meter
DWORD biclrused; // number of colors in the color table used by the bitmap
DWORD biclrimportant; // number of important colors in the bitmap display process
} Bitmapinfoheader;
000e-0011: size of the image description block, usually 28 h.
0012-0015: image width.
0016-0019: Image Height.
001a-001b: Total number of Plane Images (constant: 1 ).
001c-001d: records the number of pixels, which is an important value. The number of colors of an image is determined by this value.
001e-0021: Data Compression Method (value 0: no compression; compression ).
0022-0025: the size of the image area data.
0026-0029: the number of pixels in a horizontal meter. In a device-independent Bitmap (. Dib), each byte is set to H.
002a-002d: the number of pixels in a vertical field per meter. In a device-independent Bitmap (. Dib), each byte is set to 00h.
002e-0031: number of colors used by the image. If the value is 0, it indicates that all colors are equally important.
This article is a personal summary of online resources.