Each object in a LIST obj has a
loda chunk (lobj in some files) that says what kind of shape
it is, gives its geometry and names its fill, outline and style by id. A
trfd chunk in the object’s trfl list places it on the page.
These layouts are libcdr’s; Corel has not published them.
Sizes that change with the version
| Value | CorelDRAW 3 to 5 | CorelDRAW 6 and later |
|---|---|---|
| Count, offset or id (“unsigned”) | unsigned 16 bits | unsigned 32 bits |
| Coordinate | signed 16 bits, in 1/1,000 inch | signed 32 bits, in 1/254,000 inch |
| Angle | signed 16 bits, in tenths of a degree | signed 32 bits, in millionths of a degree |
Fill and outline ids in an argument are always 32 bits.
loda: the record
Offsets in the record count from the first byte of the chunk’s data.
0Record length the bytes of the recordunsigned…Number of argumentsunsigned…Offsets start where the table of argument offsets isunsigned…Types start where the table of argument types isunsigned…Object type rectangle, ellipse, curve…unsigned…Arguments each at the offset the table givesvaries…Argument offsets one for each argument, in ordercount × unsigned…Argument types one for each argument, last argument firstcount × unsigned
The types table is stored backwards: its first entry is the type of the last argument. An argument runs from its offset to the next thing in the record.
Object types
CorelDRAW 3 numbers the first six one lower.
| 4 and later | 3 | Object |
|---|---|---|
0x01 | 0x00 | Rectangle |
0x02 | 0x01 | Ellipse, arc or pie |
0x03 | 0x02 | Line or curve |
0x04 | 0x03 | Artistic text |
0x05 | 0x04 | Bitmap |
0x06 | 0x05 | Paragraph text |
0x0A | Embedded OLE object (6 and later) | |
0x14 | Polygon | |
0x25 | Path | |
0x26 | Spline |
Argument types
| Type | Argument | Contents |
|---|---|---|
0x1E | Geometry | The shape, laid out as below for each object type. |
0x14 | Fill | A 32-bit fill id; 0 for none. In CorelDRAW 3 the fill itself. |
0x0A | Outline | A 32-bit outline id; 0 for none. In CorelDRAW 3 the outline itself. |
0xC8 | Style | An unsigned style id. |
0x64 | Transformation | CorelDRAW 3 only: the object’s transformation. |
0x2AF8 | Polygon settings | Read by libcdr for polygons. |
0x1F40 | Transparency | Read by libcdr as the object’s opacity. |
0x4ABA | Page size | Width and height, as coordinates. |
Geometry
Each shape is drawn in its own space, from the origin, and then moved by its transformation.
Rectangle
| Field | Size | Description |
|---|---|---|
| Width | coordinate | The corner opposite the origin, x. It can be negative. |
| Height | coordinate | The same corner, y. |
| Corner radius | coordinate | Up to CorelDRAW 8, the radius of all four corners. |
| Three more radii | 3 coordinates | From CorelDRAW 9, each corner has its own radius. |
From X5 (version 15)
| Field | Size | Description |
|---|---|---|
| Width, height | 2 doubles | In 1/254,000 inch, not 32-bit integers. |
| Scale x, scale y | 2 doubles | The rectangle’s own scale; 0 counts as 1. |
| Radii scale with | 1 | 0: the radii are shares of the smaller half-side; else lengths. |
| Unknown | 7 | |
| Corner radius 1 | double | The first corner (libcdr’s r3), as a share or a length in 1/254,000 inch. |
| Corner type | 1 | 0 round, 1 scalloped, 2 chamfered. |
| Unknown | 15 | |
| Corner radius 2 | double | |
| Unknown | 16 | |
| Corner radius 3 | double | |
| Unknown | 16 | |
| Corner radius 4 | double |
The explorer draws the first radius on all four corners of a rectangle; it decodes the others.
Ellipse
| Field | Size | Description |
|---|---|---|
| Width | coordinate | The corner of the box round the ellipse, opposite the origin, x. |
| Height | coordinate | The same corner, y. |
| Start angle | angle | Where an arc or pie starts. |
| End angle | angle | Where it ends. Equal to the start angle for a whole ellipse. |
| Pie | unsigned | Not zero for a pie slice (closed to the centre), zero for an arc. |
Curve and polygon
| Field | Size | Description |
|---|---|---|
| Number of points | 2 | n. |
| Unknown | 2 | libcdr steps over it. |
| Points | n × 2 coordinates | x and y of each point. |
| Point types | n | One byte a point. |
| Point type bits | Meaning |
|---|---|
0x00 (bits 6 and 7 clear) | Start a new subpath at this point. |
0x40 | A straight line to this point. |
0xC0 | A control point of a Bézier curve. |
0x80 | The end of a curve: a cubic Bézier from the two control points before it. |
0x08 | Close the subpath at this point. |
0x10, 0x20 | The kind of node (smooth, symmetrical); they do not change the path. |
A path (type 0x25) has 4 unknown bytes, two 16-bit counts that add up
to the number of points, 16 unknown bytes, then the points and types as above.
Bitmap
From CorelDRAW 6: four coordinates (left, bottom, right, top of the frame), 32 unknown bytes, then the unsigned id of a bitmap. Up to version 5: width and height, 2 unknown bytes in CorelDRAW 3 only, 8 unknown bytes, then the id.
Text
Artistic and paragraph text objects keep their characters elsewhere, in
txsm chunks whose layout changes from version to version; see
Text and styles. The object’s own geometry is
two coordinates (x and y) for artistic text, which libcdr does not use, and for paragraph
text a field of the size of a coordinate (2 bytes before version 6, 4 later), then the
frame’s width and height. In CorelDRAW 4 an artistic text’s geometry holds its characters.
Embedded object
Type 0x0A, version 6 and later: width and height, then two opposite
corners (four coordinates). The object’s content is the Embedding n storage of
the document’s ole2 record that its olel record names; libcdr draws it
when that storage’s contents are a Photoshop, PNG, JPEG, BMP or GIF picture.
Transparency and polygon settings
Argument 0x1F40 is 10 bytes of unknown data (14 from X3) and a 16-bit
opacity in thousandths. Argument 0x2AF8 holds the settings of a polygon or star: 4
unknown bytes (before X3), the number of corners, the number of the point each point joins (read a
second time if it is 0 or 1), 4 unknown bytes from X3, the two radii as doubles and the centre as
two coordinates.
trfd: transformation
A trfd chunk begins like a loda record without the types table: record
length, number of transformations and where their offsets are, each unsigned. Each
transformation, at its offset, is:
| Field | Size | Description |
|---|---|---|
| Unknown | 8 | X3 and later only. |
| Kind | 2 | 8 for a matrix. libcdr reads nothing else. |
| Unknown | 6 | CorelDRAW 6 and later only. |
| a, b, c | 3 × 8 | From CorelDRAW 5, 64-bit doubles. c is a shift in 1/1,000 inch (version 5) or 1/254,000 inch (6 and later). |
| d, e, f | 3 × 8 | The same for y. |
A point moves to x′ = a·x + b·y + c, y′ = d·x + e·y + f. In CorelDRAW 4, a, b, d and e are 32-bit 16.16 fixed-point numbers and c and f are signed 32-bit thousandths of an inch, so each matrix is 24 bytes.
libcdr applies an object’s own matrix, then the matrix of the innermost group it is in. The page’s centre is the origin and y grows upwards, so a viewer that draws with y downwards adds half the page size and turns y over.