Public Painter file format
Public Painter *.CMP Always monochrome. 1 byte flag [used during decompression] 1 byte size [0 = A5/640x400, 200 = A4/640x800] ------- 2 bytes total for header ? image data: The image data is always RLE compressed. Depending on the size field the uncompressed image will be 32000 or 64000 bytes. Decompression code -> parameters: data = source address (compressed image data) bmap = destination address (uncompressed monochrome image data) flag = first item from file header cds = compressed data size (file size minus sizeof(header)) /* Written by Lonny Pursell, placed in the Public Domain 1/7/2017 */ uint32 decode_cmp(uint8 *data, uint8 *bmap, uint8 flg, uint32 cds) { register uint8 byt, cmd; register uint16 i, cnt; register uint32 dst=0, src=0; do { cmd = data[src++]; if (cmd == flg) { /* repeat? */ cnt = 1 + data[src++]; byt = data[src++]; for (i=0; i<cnt; i++) { bmap[dst++] = byt; } } else { /* literal ? */ bmap[dst++] = cmd; } } while (src<cds); return dst; }
Back to ST Picture Formats