Corel Presentation Exchange is Corel’s format for passing a drawing to other programs. A
.cmx file is a RIFF file like a
CorelDRAW drawing, but it holds a list of drawing instructions rather than objects, and it
is a different format with different chunks. CorelDRAW 6 and later also save one inside the
drawing, in a chunk called cmx1, and full-colour pattern fills (vpat)
are CMX files too. This page follows libcdr’s reader (its CMXParser), which
the Document Liberation Project wrote from files, as nothing is published. The tagged data inside an instruction is not described here;
libcdr reads only some of the instructions.
The file
It starts RIFF, a 32-bit length and the form type CMX1. libcdr
accepts RIFX, the big-endian form, and a form type of any case that starts
“CMX”; the byte order is also given in the header. The chunks seen in a real file, the one in the
CorelDRAW 6 drawing MP3_CD.CDR, are these:
| Chunk | Times | Holds |
|---|---|---|
cont | 1 | The header, 180 bytes. |
ccmm | 1 | 72 bytes, not read by libcdr. |
page | 6 | A page: a list of instructions. |
rlst | 6 | 40 bytes after each page, not read by libcdr. |
rfnt | 1 | The font description section. |
rotl, rott, rpen, rdot, rota | 1 each | Description sections: outlines, line styles, pens, dot-dash patterns, arrowheads. |
rclr | 1 | The colour description section: a 16-bit count and the colours. |
rscr | 1 | The screen description section. |
LIST indx | 1 | The index: ixlr (a page’s layers, one per page), ixtl (index tables), ixpg (the pages) and ixmr (the master index). |
LIST INFO | 1 | Keywords (IKEY) and a comment (ICMT). |
A file can also hold a DISP thumbnail (its header offset says where; the
file above has none) and, for bitmaps, LIST imag lists of an
info chunk and a data chunk.
cont: the header
| Offset | Size | Field | In MP3_CD.CDR |
|---|---|---|---|
| 0 | 32 | File identifier, text | {Corel Binary Meta File} |
| 32 | 16 | Platform, text | Windows 3.1 |
| 48 | 4 | Byte order, text: 2 little-endian, 4 big-endian | 2 |
| 52 | 2 | Coordinate size, text: 2 or 4 bytes | 4 |
| 54 | 4 | Major version, text | 2 |
| 58 | 4 | Minor version, text | 0 |
| 62 | 2 | Base units, a code | 35 (0x23) |
| 64 | 8 | Units scale, a double: metres a unit | 1e-7 |
| 72 | 12 | Unknown | zeros |
| 84 | 4 | Index section offset, from the start of the file | 0xCFF6, the ixmr chunk |
| 88 | 4 | Info section offset | 0xD04C, the LIST INFO |
| 92 | 4 | Thumbnail offset; 0xFFFFFFFF none | 0xFFFFFFFF |
| 96 | 4 coordinates | Bounding box | –1,234,567; 617,411; 2,355,310; –881,889 |
| 112 | 68 | Unknown | one non-zero field, 453, then zeros |
The coordinate size, 2 or 4 bytes, decides the width of every coordinate in the file and how the tagged data inside the instructions is laid out (a 16-bit file has no tags).
The index
ixmr: the master index
| Field | Size | Description |
|---|---|---|
| Master id | 2 | |
| Size | 2 | |
| Number of records | 2 | n. |
| Records | n × 6 | A section type (2) and its offset from the start of the file (4). |
| Type | Section | Type | Section |
|---|---|---|---|
| 1 | master index table | 16 | line style descriptions |
| 2 | page index table | 17 | arrowhead descriptions |
| 3 | master layer table | 18 | screen descriptions |
| 4 | procedure index table | 19 | pen descriptions |
| 5 | bitmap index table | 20 | dot-dash descriptions |
| 6 | arrow index table | 21 | colour descriptions |
| 7 | font index table | 22 | colour correction |
| 8 | embedded file index table | 23 | preview box |
| 10 | thumbnail | 15 | outline descriptions |
ixpg: the page index
A 16-bit count of pages; then for each page, in a file of 32-bit coordinates, its size in the file (2 bytes, at least 16), then four 32-bit offsets: the page, its layer table, its thumbnail and its reference list. libcdr reads each page offset once.
page and proc: instructions
A page chunk (or a procedure, proc) is a series of instructions. Each
starts with its size as a signed 16-bit number (a negative one means a 32-bit size follows),
then a signed 16-bit code, whose absolute value names the instruction; the data follows up to
the size. In a 32-bit file the data is a series of tags: a tag byte, a length and the
tag’s data, ending in the tag 0xFF.
| Code | Instruction | Code | Instruction | Code | Instruction |
|---|---|---|---|---|---|
| 2 | Comment | 66 | Ellipse | 93 | SetGlobalTransfo |
| 9 | BeginPage | 67 | PolyCurve | 94 | AddGlobalTransform |
| 10 | EndPage | 68 | Rectangle | 95 | RestoreLastGlobalTransfo |
| 11 | BeginLayer | 69 | DrawImage | 98 | TextFrame |
| 12 | EndLayer | 70 | BeginTextObject | 99 | BeginParagraph |
| 13 | BeginGroup | 71 | EndTextObject | 100 | EndParagraph |
| 14 | EndGroup | 72 | BeginTextGroup | 101 | CharInfo |
| 17 | BeginProcedure | 73 | EndTextGroup | 102 | Characters |
| 18 | EndSection | 85 | SetCharStyle | 103 | PushTint |
| 20 | BeginTextStream | 86 | SimpleWideText | 104 | PopTint |
| 21 | EndTextStream | 88 | AddClippingRegion | 111 | JumpAbsolute |
| 22 | BeginEmbedded | 89 | RemoveLastClippingRegion | ||
| 23 | EndEmbedded | 90 | ClearClipping | ||
| 65 | DrawChars | 91, 92 | PushMappingMode, PopMappingMode |
libcdr draws the instructions BeginPage, BeginLayer, BeginGroup, PolyCurve, Ellipse, Rectangle, DrawImage and JumpAbsolute; it skips the others by their size. The tags of the ones it reads (rendering attributes with fills, outlines and lenses, point lists, boxes) are not described on this page.
In a drawing
A CorelDRAW 6 drawing has a cmx1 chunk whose data is a whole CMX file, starting
RIFF. In MP3_CD.CDR it is 53,416 bytes with six page chunks, one for each
page of the drawing. The explorer offers it as a file of its own.
In the explorer
A CMX file opens with its chunks, the header and the index field by field, and each page as a list
of instructions named by their codes. The instructions are not drawn and their tagged data, the
description sections (rclr, rpen and the others) and a big-endian
(RIFX) file are not decoded.
CPX and other names
The format is named Corel Presentation Exchange. Files called .cpx and
.cdrx, which are sometimes linked with CorelDRAW, were not found in any
source this page follows and no sample could be had, so nothing is claimed about them;
the one .cpx on the machine this was written on (a Windows for Workgroups
file) is something else. The explorer opens .cmx files that start like a CMX
file; other files that happen to be called .cmx (the Fuchsia component manifests,
for one, are JSON) are not CMX and show as what they are.