Paint Data Section
This section contains all the data of a picture.
Size Description
L Size of Paint Data Section (including this long)
L Offset within Paint Data Section of pixel data. Always 28 00 00 00 ?
L X Size of picture in dots
L Y Size of picture in dots
Length X Size of the picture in twips. 00 00 00 00 means unspecified.
Length Y Size of the picture in twips. 00 00 00 00 means unspecified.
L Number of bits in a dot. Usually 02 00 00 00
L Always 00 00 00 00 ?
L Always 00 00 00 00 ?
L 01 00 00 00 if RLE encoded, 00 00 00 00 if plain data
L (CA) Always FF FF FF FF ?
L (CA) Always 44 00 00 00 ?
Pixel data
The two longs marked (CA) are only found in a Clip Art File. Their use is unknown. They are not included in the size of the section (first long) and the offset of the pixel data (second long): you should add 8 to both of them.
RLE encoding consists of sequences of marker bytes with data bytes. A marker byte of 00 to 7F means that the next byte should be repeated that many times and once more. A marker byte of 80 to FF means that (100-marker) bytes of data follow.
Though all lines have the same length, this length can be a little larger than the picture X size. The remaining padding should be discarded. The length of a line is always a whole number of bytes (after RLE decoding).
Each byte can encode several pixels. The number of bits per pixel is usualy 2, and I presume only values of 1, 2, 4 and 8 are valid. If others are valid, I do not know how they are exactly stuffed into bytes.
If the number of bits per pixel equals 2 (I never saw a file wich had another value), each byte encodes four pixels. A pixel is two bits wide, and can range from black to invisible:
Value Color
0 Black
1 Dark grey
2 Light grey
3 Invisible
The lowest two bits are for the leftmost pixel, the highest two bits are for the rightmost pixel:
Bits Pixel
0,1 Leftmost
2,3 Left middle
4,5 Right middle
6,7 Rightmost