byte. in addition, the first byte of the pair can be set to zero to indicate an escape that denotes an end of line, end of bitmap, or a delta. the interpretation of the escape depends on the value of the second byte of the pair. the following list shows the meaning of the second byte:
value meaning
0 end of line. 1 end of bitmap. 2 delta. the two bytes following the escape contain unsigned values indicating the horizontal and vertical offset of the next pixel from the current position.
absolute mode is signaled by the first byte set to zero and the second byte set to a value between 0x03 and 0xff. in absolute mode, the second byte represents the number of bytes that follow, each of which contains the color index of a single pixel. when the second byte is set to 2 or less, the
escape has the same meaning as in encoded mode. in absolute mode, each run must be aligned on a word boundary. the following example shows the hexadecimal values of an 8-bit compressed bitmap:
03 04 05 06 00 03 45 56 67 00 02 78 00 02 05 01 02 78 00 00 09 1e 00 01
this bitmap would expand as follows (two-digit values represent a color
index for a single pixel):
04 04 04 06 06 06 06 06 45 56 67 78 78 move current position 5 right and 1 down 78 78 end of line 1e 1e 1e 1e 1e 1e 1e 1e 1e end of rle bitmap
bi_rle4
when the bicompression member is set to bi_rle4, the bitmap is compressed using a run-length encoding (rle) format for a 4-bit bitmap, which also uses encoded and absolute modes. in encoded mode, the first byte of the pair contains the number of pixels to be drawn using the color indexes in the second byte. the second byte contains two color indexes, one in its high-order nibble (that is, its low-order four bits) and one in its low-
order nibble. the first of the pixels is drawn using the color specified by the high-order nibble, the second is drawn using the color in the low-order nibble, the third is drawn with the color in the high-order nibble, and so on, until all the pixels specified by the first byte have been drawn. in absolute mode, the first byte contains zero, the second byte contains the number of color indexes that follow, and subsequent bytes contain color indexes in their high- and low-order nibbles, one color index for each
pixel. in absolute mode, each run must be aligned on a word boundary. the end-of-line, end-of-bitmap, and delta escapes also apply to bi_rle4.
the following example shows the hexadecimal values of a 4-bit compressed bitmap:
03 04 05 06 00 06 45 56 67 00 04 78 00 02 05 01 04 78 00 00 09 1e 00 01
this bitmap would expand as follows (single-digit values represent a color index for a single pixel):
0 4 0 0 6 0 6 0 4 5 5 6 6 7 7 8 7 8 move current position 5 right and 1 down 7 8 7 8 end of line 1 e 1 e 1 e 1 e 1 end of rle bitmap
see also
bitmapinfo
============================================================================
== rgbquad (3.0)
typedef struct tagrgbquad { /* rgbq */ byte rgbblue; byte rgbgreen; byte rgbred; byte rgbreserved; 上一篇:bmp format(bmp文件格式) 下一篇:数据安全的注意事项 |