## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### BITMAPINFO2 Field - ulCompression

ulCompression (ULONG) Compression scheme used to store the bit map.

BCA_UNCOMP Bit map is uncompressed.

BCA_HUFFMAN1D The bit map is compressed by a modified Huffman encoding. This is valid for a bi-level (one bit per pel) bit map.

BCA_RLE4 The bit map is a 4-bit per pel run-length encoded bit map. See the following section, "Format of Compressed Data," for a description of the format of the compressed data.

BCA_RLE8 The bit map is an 8-bit per pel run-length encoded bit map. See the following section, "Format of Compressed Data," for a description of the format of the compressed data.

BCA_RLE24 The bit map is a 24-bit per pel run-length encoded bit map. See the following section, "Format of Compressed Data," for a description of the format of the compressed data.

Format of Compressed Data

Encoding a run length:

Run-length encoded bit maps are encoded in the buffer in a controlled format. In all cases, if the first byte is non-zero, it is the length of a run of pels of a particular color or, in the case of a BCA_RLE4 bit map, a run of a length of pels of alternating colors.

    1st-byte       pel repetition count >= 1

    2nd-4th bytes  (BCA_RLE24 only) RGB value of pel.

    2nd-byte       (BCA_RLE8) color index of pel to be repeated

                   (BCA_RLE4) the second byte contains 2 4-bit

                   color indexes.  The repetition count is

                   completed by alternately choosing the high-order

                   nibble followed by the low-order nibble for the

                   succeeding pels until the count is exhausted.

Unencoded run:

An unencoded run is a string of pels to be placed in consecutive positions in the destination bit map.

    1st-byte     0

    2nd-byte     COUNT = a multiple of 3 for BCA_RLE24 bit maps, or

                 COUNT >= 3 (for BCA_RLE4 and BCA_RLE8 bit maps).

followed by the bytes as follows:

BCA_RLE24 A string of bytes specifying the RGB color values of succeeding pels. If COUNT is odd, it must be padded by a zero byte for an even length overall.

BCA_RLE8 A string of bytes specifying color indexes for succeeding pels. If COUNT is odd, it must be padded by a zero byte for an even length overall.

BCA_RLE4 A string of bytes, each byte providing two color indexes, with the high-order nibble specifying the index of the pel preceding the low-order nibble. The COUNT specifies the number of indexes. The overall length of the string must be an even number of bytes, and thus may be padded with a zero byte, and the low order nibble of the last significant byte may also be zero and not used.

Delta record:

A delta record indicates a shift in position in the destination bit map before the next record is decoded.

    1st-byte        0

    2nd-byte        2

    3rd-byte        Delta-x (unsigned)

    4th-byte        Delta-y (unsigned)

This is a relative jump record. It implies that the next record is to be decoded into a position in the destination bit map at an offset from the current position, determined by changing the horizontal and vertical positions by Delta-x and Delta-y, respectively.

End-of-line record:

The end-of-line record signifies that the data for the current scan line is complete and that decoding of the next record should begin at the start of the next scan line.

    1st-byte        0

    2nd-byte        0

End-of-RLE record:

The end-of-RLE record signifies the end of the data in the RLE compressed bit map.

    1st-byte        0

    2nd-byte        1