Where each layout comes from
The reader relies on the record layouts below. Code cites a row by its id (R1 ...), and
tests/it/provenance.rs fails when a cited id has no row here.
Sources:
- K: the Kaitai Struct specification
coreldraw_cdr.ksy(MIT, notice inLICENSE-kaitai.txt), https://github.com/kaitai-io/coreldraw_cdr.ksy/blob/9d8e2704b946961f5114115f1a488750a3c86ed0/coreldraw_cdr.ksy - KF: the fork of K by Zach Wolfe,
filestar/coreldraw_cdr.ksy, branchnew_stuff, under the same MIT license and notice as K (LICENSE-kaitai.txt), https://github.com/filestar/coreldraw_cdr.ksy/blob/2189b68f07e0cafe9afec3dcf699ebc0342144c7/coreldraw_cdr.ksy - KR: the README and the
bin/cdr-unpkscript of the Kaitai Struct specification (MIT), at the same commit as K, https://github.com/kaitai-io/coreldraw_cdr.ksy/blob/9d8e2704b946961f5114115f1a488750a3c86ed0/README.md and https://github.com/kaitai-io/coreldraw_cdr.ksy/blob/9d8e2704b946961f5114115f1a488750a3c86ed0/bin/cdr-unpk - Z: the PKWARE ZIP specification, APPNOTE.TXT version 6.3.10, https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT, and RFC 1951 (DEFLATE), https://www.rfc-editor.org/rfc/rfc1951
- F: the magic database of the
fileutility (BSD-2-Clause), https://github.com/file/file/blob/b778217dbd35/magic/Magdir/images and https://github.com/file/file/blob/b778217dbd35/magic/Magdir/riff - PR: the PRONOM registry's signatures for versions 1.0, 2.0 and 4.0, https://pronom.nationalarchives.gov.uk/fmt/467.xml, https://pronom.nationalarchives.gov.uk/fmt/466.xml and https://pronom.nationalarchives.gov.uk/fmt/465.xml
- S: own inspection of the bytes of public sample files, checked against the picture each file
carries of its drawing where it has one (versions 2 and 4 to 25; files of versions 1 and 3 carry
none). The files come from:
- TP: https://telparia.com/fileFormatSamples/image/cdr/, by file name
- LT: https://git.libreoffice.org/libcdr-test at commit
dafe4fe53d685d89df20a5c0bb18f318ccefb4a8,testset/<version>/<file> - UC: https://svn.code.sf.net/p/uniconvertor/code/formats/CDR/testing%20base/ at revision 434, by file name
- TDF: attachments to The Document Foundation's bug tracker, https://bugs.documentfoundation.org/attachment.cgi?id=
- NR: Natural Resources Canada's tactile maps, https://ftp.maps.canada.ca/pub/nrcan_rncan/raster/tactile/approach-approch/cdr/banff_ap_en.cdr and https://ftp.maps.canada.ca/pub/nrcan_rncan/raster/tactile/atlas-atlas/cdr/ab_en_br.cdr
- DM: the clip art of https://discmaster.textfiles.com/browse/31541, by file name
- CX: the
.cmxfiles of https://telparia.com/fileFormatSamples/image/cmx/, by file name. The nine with 32-bit coordinates areballoon.cmx,bars.cmx,bluecros.cmx,bluedrop.cmx,gold_bar.cmx,goldblue.cmx,PC.CMX,squares.cmxandthatch.cmx; they carry no picture of their drawing.
- CN: the
.cmxnotes of an MIT OR Apache-2.0 drawing program, which mark each layout "confirmed" when the program's authors found it in sample files, https://github.com/tracedraw/tracedraw/blob/2ac6d02e97773e040a51be6cfb27cc424e3deeaa/docs/cmx-format.md. The same program's.cmxreader at that commit, https://github.com/tracedraw/tracedraw/blob/2ac6d02e97773e040a51be6cfb27cc424e3deeaa/crates/cdr/src/cmx.rs, was read for the order of fields that the notes do not spell out (the table entries, the rendering attributes and the curve body); no code was copied from it
Status: public-spec (K, KF, KR, Z, F or PR), sample (S), public-notes (a layout CN marks
confirmed that no CX file shows), unconfirmed (a point no source states and no sample file shows;
listed so it can be checked against a file, with what the reader does when it is wrong).
Public specifications cover only parts of versions 1 to 4: the rows that cite K, F or PR, such as
the version 3 fill (R34) and page settings (R38). The other rows of those versions rest on the
sample files they name.
The test inputs are the synthetic files that src/synth.rs builds from the rows below; no sample
file is committed.
| Id | What the code relies on | Source | Status |
|---|---|---|---|
| R1 | RIFF, the body length, then the form type CDR or cdr and a version character: 1 to 9, A (10) to H (17), J (18) on, I unused; cdr8 is 8.01 from the form type alone, whatever its vrsn chunk names, CDR is 3, CDRX is another format. Files of versions 23 to 25 carry O (23), P (24), Q (24.3, with a vrsn of 2430) and R (25), which count differently from the version 24 update on, so their vrsn chunk decides (R2) |
K L68-L133; S: LT testset/23 to testset/25, such as circle_redfill_nooutline_cdr25.cdr |
public-spec (letters from version 23: sample; letters of versions 26 and 27: unconfirmed, and the vrsn chunk decides when the file has one) |
| R2 | vrsn: the version as a u16, in hundreds |
K L276-L278 | public-spec |
| R3 | LIST cmpr: two (compressed, uncompressed) u32 pairs, then two blocks of CPng, 01 00 04 00 and a zlib stream; the first inflates to the chunk stream, the second to a pool of u32 sizes that each chunk's size field indexes |
K L193-L220, L2626-L2682 | public-spec |
| R4 | A chunk is an id, a u32 size and the body, padded to an even length; a LIST body starts with its form type; from version 7 a LIST stlt holds the style tables, not chunks |
K L68-L78, L135-L155, L307-L334 | public-spec |
| R5 | Coordinates: i16 in 1/1000 inch before version 6, else i32 in 1/254000 inch; header fields, counts and offsets are u16 before version 6, else u32 | K L58-L66, L2688-L2700 | public-spec |
| R6 | loda and lobj: length, argument count, offsets table, types table, object type; count + 1 offsets bound the arguments; the types table runs in reverse; object types (1 rectangle, 2 ellipse, 3 curve, 0x14 polygon) and argument types (10 outline, 20 fill, 30 coordinates, 1000 name, 11000 polygon, 19130 page size) |
K L335-L450, L846-L893 | public-spec |
| R7 | Angles: i16 tenths of a degree before version 6, else i32 millionths of a degree | K L2835-L2855 | public-spec |
| R8 | trfd: length, count, offsets table; each entry has 8 bytes first from version 13, a u16 type, and type 8 is a matrix after 6 bytes (from version 6) of six f64 a c tx b d ty, tx and ty in coordinate units; the matrices of one record apply in file order |
K L895-L953, L2808-L2834 | public-spec |
| R9 | Name argument (1000): Windows-1252 up to a NUL before version 12, UTF-16LE from it | K L601-L630 | public-spec |
| R10 | mcfg: 12 bytes (13 on), 4 (9 to 12), 28 (6) or none, then the page width and height as coordinates |
K L1670-L1765 | public-spec |
| R11 | fild (fill before 7): id; from 13 a record tagged 1300 with its length, which records tagged 2400 or more may precede; the fill type u16 (0 none, 1 uniform, others not read); uniform: 2 bytes then a color before 13, from 13 a record tagged 1300 holding a property list (u8 type, u32 length, body; 0 ends it; 1 a color, 8 a palette id and a UTF-16 name, 3 a UTF-16 name) |
K L1025-L1302; S: LT testset/15 to testset/25 circle_redfill_nooutline_cdr<version>.cdr, whose fill records hold a record tagged 2400 before the one tagged 1300 |
public-spec (2400 records: sample) |
| R12 | outl: id; from 13 records (u32 id, u32 length, body) up to id 1, whose body follows; a record of id 2 holds a property list laid out as R11's, and the reader takes the outline's color from it when it names a library color; line type, caps and join u16; 2 bytes (6 to 12); width; stretch u16; 2 bytes (6 on); nib angle; 52 bytes (6 to 12) or 46 (13 on); the color; 16 bytes (10 before 6); the dash count u16 and the dashes, in multiples of the width; the arrowhead ids 22 bytes after the first dash in versions 6 to 12, 20 bytes from 13. Caps 0 butt, 1 round, 2 square; joins 0 miter, 1 round, 2 bevel |
K L954-L1024; KF L1225-L1249 (the id 2 record); S: caps and joins in UC outl_line_caps_cdr7.cdr and outl_corner_cdr7.cdr; arrowhead ids, matched against the drawing's arrw records, in TP web_cd.cdr (6), UC rogan_logo_cdr7.cdr, rogan_logo_cdr8.cdr and rogan_logo_cdr11.cdr, NR ab_en_br.cdr (9) and banff_ap_en.cdr (10), TDF 76820 (12) and 140638 (13) |
public-spec (caps, joins and arrowhead places: sample; arrowheads before version 6: no sample names one, and the reader does not look for them; the id 2 record: no sample names a library color in it, and a wrong guess changes only the outline's color) |
| R13 | Bit 0 of the outline's line type: no outline | S: LT square_blackfill_nooutline_cdr<version>.cdr and the other nooutline files of testset/15 to testset/25, whose outline records all have line type 1 and whose pictures show no outline |
sample |
| R14 | A color record from version 5: model u16, palette u16, 4 bytes, four value bytes. Models: 2 CMYK in percent, 3 and 17 CMYK 0 to 255, 4 CMY 0 to 255, 5 blue, green, red, 9 gray 0 to 255, 20 registration, 21 blue, green, red and a tint in percent already applied; 1, 14 and 25 a library color's number (u16) and tint in percent (u16) | K L2856-L2965; S: model 25 in LT testset/12/square_pantoneblackfill_nooutline.cdr (number 14, tint 100), model 1 in UC rogan_logo_cdr11.cdr (number 4, tint 50) |
public-spec (library values of models 1 and 25: sample; model 14: unconfirmed, and its color opens as a spot color without a look) |
| R15 | Rectangle coordinates: width, height and one radius, three more radii from version 9, running counterclockwise from the corner at (width, 0) | K L674-L700 | public-spec |
| R16 | Point list: u32 count (before version 6 as R39 gives it), the points, then one type byte each, the count held to what fits; type bits 7 and 6 move, line, curve end, control point; bit 3 closes the subpath | K L782-L787, L840-L845, L2701-L2807 | public-spec |
| R17 | Ellipse coordinates: width, height, start and end angles, pie flag (u16 before 6, else u32); the radii are half the width and height; the angles turn from the ellipse's own axes, which a negative width or height points the other way | K L754-L781; S: the pies of negative height in the ellipse-sector drawings of versions 12 and 13 in UC | public-spec (axis direction of a negative size: sample) |
| R18 | Polygon argument (11000): 4 bytes before 13, the side count u32, the next point u32 (the u32 after it when it is 0 or 1, else 4 bytes), 4 more from 13, rx and ry f64, the centre; the base curve is one side on a circle of 1000 mm from the top vertex to the vertex it runs to clockwise, copied once for each side | K L631-L655; S: the polygons and stars of UC shapes_cdr10.cdr |
public-spec (base curve: sample) |
| R19 | flgs: byte 3 the record type, byte 2 marks the master page. On a layer, group or object, bit 0x01 of byte 1 hides it and bit 0x10 of byte 0 locks it. A layer's own loda names what it is by its object type: 11 a grid, 12 guides, 17 the desktop, any other a drawing layer (version 3 one less, R32). Only a layer without a loda is taken by the low four bits of its byte 0: 0x0a guides, or a grid when bit 0x10 is also set; in versions 7 to 13 0x02 the same way; 0x08 the desktop when byte 2 is set and a drawing layer when it is clear; any other a drawing layer, except [0, 1, 1] in versions 7 to 13, the desktop |
K L1602-L1639 (record types); KF L1831-L1866 (the hidden and lock bits); S: every grid layer of versions 14 to 25 in the sample files (631) carries byte 1 = 1, and 206 of the 927 of versions 7 to 13 do; desktop layers carry byte 1 = 0 except TDF 114901's [0, 1, 1]; the drawing layers with byte 1 = 1 (TDF 114901, NR banff_ap_en.cdr and symbology_en.cdr) also carry bit 0x08; of the group and object lists in the sample files, only one object of TDF 60491 (version 14) sets either bit, the lock bit; in every sample file of versions 3 to 25 the layer's object type agrees with its name; byte 0 does not: TDF 114901 (version 8) flags its master page's guides [2, 1, 1], desktop [0, 1, 1], grid [0x12, 0, 1] and drawing layer [8, 1, 0], and NR ab_en_br.cdr (version 9) flags drawing layers 0x10 and its guides 0x1a; over the sample files of versions 3 to 25, drawing layers carry 0, 0x10, 0x40, or 0x08, 0x18 or 0x58 with byte 2 clear, desktop layers 0x08, 0x18 or 0x48 with byte 2 set, guides 0x0a, 0x4a, 0x02 or (in ab_en_br.cdr) 0x1a, and grids 0x1a, 0x5a or 0x12 |
public-spec (layer types: sample; byte 0 of a layer without a loda: unconfirmed, as no sample has such a layer, and a wrong guess drops or shows that layer's objects; bit 0x10 is also the lock bit, so a locked guides layer without a loda reads as a grid) |
| R20 | Fill and outline arguments (20, 10): a u32 record id | K L452-L460, L548-L556 | public-spec |
| R21 | Page size argument (19130): width and height | K L666-L672 | public-spec |
| R22 | LIST page holds LIST layr lists, directly or in a list it holds (a LIST gobj in the samples); a layer holds LIST obj and LIST grp ; a page, layer or object keeps its own loda (and an object its trfd, in a trfl list) among its chunks or in a LIST lgob |
K L1602-L1639 (record types); S: the chunk trees of every sample file of versions 3 to 25 | sample |
| R23 | Guideline (object type 0x16), argument 16000: 12 bytes, the angle in millionths of a degree, then points from the page centre; version 7 keeps them in a guid chunk: a u32 count, the count again, 40-byte records laid out the same way |
S: argument 16000 in NR ab_en_br.cdr (9) and TDF 194220 (13); the guid chunk of TDF 123971 (7). Pictures do not show guidelines |
sample |
| R24 | ZIP: the end of central directory record (signature PK\5\6, 22 bytes and a comment of up to 65,535 bytes) gives the member count and where the central directory lies; each central directory entry (46 bytes, then name, extra field and comment) gives the flags, method, CRC-32, sizes and its local header; a local header is 30 bytes, then its name and extra field, then the member's bytes. Flag bit 0 marks an encrypted member; method 0 is stored and 8 deflated; 0xFFFF and 0xFFFFFFFF mark ZIP64 fields, and a ZIP64 locator (PK\6\7, 20 bytes) precedes the end record of a ZIP64 archive; disk numbers other than 0 mark an archive split across files |
Z 4.3.7, 4.3.12, 4.3.15, 4.3.16, 4.4.1.4, 4.4.4, 4.4.5, 4.4.7, 4.4.8, 4.4.13 | public-spec |
| R25 | Versions 14 and 15 save a ZIP package whose member content/riffData.cdr is the RIFF file |
KR README L33, cdr-unpk L30 |
public-spec |
| R26 | From version 16 the package's member content/root.dat is the RIFF file; content/dataFileList.dat names the data streams, one per line, members of content/data/; a redirect's stream number counts lines from 0 |
KR README L34, L40, cdr-unpk L34-L66; K L173-L180 |
public-spec |
| R27 | In a package of version 16 on, a chunk outside a compressed list whose size is 16 (in root.dat or in a redirected list's body) is a redirect record: stream u32, length u32, offset u32 and a reserved u32; its body is length bytes at offset of the stream; stream 0xFFFFFFFF holds the body (at most 8 bytes) in the record after the length; a redirected list's body starts with its form type |
K L144-L193 | public-spec |
| R28 | Templates have the form type CDT and a letter of their own; the vrsn chunk names the version. The reader takes any letter A to Z there |
none: no sample template | unconfirmed (a template is read as a drawing of the version its vrsn chunk names, and one without that chunk is refused) |
| R29 | Rectangle coordinates from version 15: width and height as f64 coordinate units, scale x and y (f64, repeating the transform's scale), the scale-with flag (u8) and 7 bytes, then the four radii as f64, 16 bytes apart (a corner type byte and 15 bytes after the first), in the order of R15. With the flag clear each radius is a share of half the shorter side; with it set the radii are multiplied by 254000 coordinate units, which makes them inches | K L674-L752; S: LT square_blackfill_nooutline_roundedcorners_cdr<version>.cdr of testset/15 to testset/25 (flag clear, a share of 0.25) |
public-spec (radius share with the flag clear: sample; that the scale is not applied: unconfirmed, as every sample has a scale of 1, and a wrong guess changes only the corners' size) |
| R30 | Object type 0x25 (version 10 on) is a path: 4 bytes, two u16 counts that add up to the point count, 16 bytes, then the points and their type bytes as in R16 | K L788-L799, L892; S: TDF 78250 (version 15) and UC shapes_cdr10.cdr, shapes_cdr11.cdr, shapes_cdr12.cdr and shapes_x3.cdr (versions 10 to 13), whose type bytes start where the counts put them; no sample before version 10 holds the type |
public-spec (from version 10: sample) |
| R31 | Version 3 is a RIFF file with the form type CDR (a space) and a vrsn of 300; version 4 has the form type CDR4 and a vrsn chunk. Both use the 16-bit fields of R5 and R7. Their pages, layers, groups and objects are read by the rules of R19 and R22 |
K L117-L134; PR fmt/465; F riff L786; S: TP FOX.CDR and DALI.CDR (3), DM lion1.cdr and tiger.cdr (4) |
public-spec (pages and layers as R19 and R22: sample) |
| R32 | Version 3 counts its object types from 0: rectangle 0, ellipse 1, curve 2, text 3, bitmap 4; later versions use these plus one | S: the rectangles, curves and text of TP ARMYSTF1.CDR, DALI.CDR and FOX.CDR, which come out whole |
sample (ellipse 1 and bitmap 4: unconfirmed, as no sample holds them; a bitmap is left out with a warning) |
| R33 | Version 3 keeps an object's transforms in argument 100 of its lobj: a u16, the entry count (u16), then 10-byte entries of a type (u16) and, at byte 6, where the entry's data starts, counted from the start of the argument. Type 0x8c is a matrix as R37, and the matrices apply in file order. Type 0x14 is an envelope, which this reader does not apply: the shape keeps its outline, placed by the matrices alone, and the drawing's warnings name the envelopes. A group's own lobj holds an argument 100 that places all of the group's objects after their own transforms |
K L851; S: the matrices of every version 3 file in TP, whose drawings come out whole | sample (envelope type 0x14: unconfirmed, as no sample holds one; it is not applied, with a warning) |
| R34 | Version 3 fill, argument 20: a type byte (0 none, 1 uniform, 2 and 4 fountain, 6 texture, 7 and 10 pattern); a uniform fill's color follows as R36 | K L452-L547 | public-spec |
| R35 | Version 3 outline, argument 10: a flags byte with bit 0 set when the object is outlined, the width (coordinate), the stretch (u16), the nib angle, the color as R36, 7 bytes, the dash count (u8) and 10 bytes that hold the dashes as one byte each, the join (u16 at byte 30) and the caps (u16 at byte 32) numbered as R12, then the two arrowhead ids (u32). Dashes are read in multiples of the width as R12 | K L548-L592; S: the outlines of the version 3 files in TP | public-spec (flag bit: sample; dash unit, and the join, where bytes 32 and 33 of some samples hold 2 and 2: unconfirmed, and a wrong guess changes only how corners, ends and dashes are drawn) |
| R36 | A color before version 5: in versions 1 to 3 a model byte and four value bytes, in version 4 a model u16, four u16 values and 2 bytes. Model 1 is cyan, magenta, yellow and black in percent. Model 0 is an ink number (u16) and a tint in percent (u16): ink 0 is black at the tint, ink 1 is white, and other numbers are inks of a numbered library that the file does not store. Other models are read as R14 | K L2882-L2908; S: model 1 in TP ARMYSTF1.CDR (3) and DM lion1.cdr (4), model 0 in TP ARROW5.CDR (3) and WI.CDR (1) |
sample (ink 1, and models other than 0 and 1: unconfirmed; an ink of another number opens as a spot color without a look) |
| R37 | A matrix of versions 3 and 4: six i32 a c tx b d ty, the four factors in 16.16 fixed point and tx and ty in coordinate units. A version 4 trfd entry of type 8 holds one where R8 has six f64 |
S: TP FOX.CDR and DALI.CDR (3), DM lion1.cdr and tiger.cdr (4) |
sample |
| R38 | mcfg of version 3: 2 bytes, then the page's two corners as four coordinates; the page size is the distance between them |
K L1676-L1678, L1745-L1756 | public-spec |
| R39 | A point list before version 6 starts with a u16 count and another u16 (1 in some curves of versions 1, 2 and 4, 0 in the others), where K reads the two as one u32 | S: TP DALI.CDR (3), DM headup.cdr and lion1.cdr (4), TP WI.CDR (1), FLAG.CDR and MENU.CDR (2) |
sample |
| R40 | Versions 1 and 2 are not RIFF files. A file starts with WL, a marker byte, a zero byte and five u32: the start of the settings, the start and the end of the object records, the start of the trailer and that value minus two. Version 1 has the marker e and its settings start at byte 28. Version 2 has the marker m or l, and its settings start after a 1-bit picture of the drawing, whose header starts where the u32 at byte 28 says. The reader takes these three markers |
F images L4159-L4172; PR fmt/467, fmt/466; S: TP WI.CDR (e), FLAG.CDR (m), MENU.CDR and DRINKS.CDR (l) |
public-spec (markers e and m: F and PR; the offsets and the marker l: sample) |
| R41 | The page's box in a file of version 1 or 2: four i16 two bytes after the start of the settings (left, top, right, bottom) in 1/1000 inch around the page's centre, y pointing up | S: TP WI.CDR, FLAG.CDR and MENU.CDR |
sample |
| R42 | The records of a file of version 1 or 2 run from the front of the stacking order to the back. Every record starts with the u32 24. A group or layer record is 28 bytes, and bit 0x40 of its flags byte at 26 is clear. A drawn object has that bit set (0x40 in files with the markers e and m, 0xc0 with l) and a u16 body size at byte 28; it is the body size plus 32 bytes long. A drawn object of another type than those of R43 gives its length otherwise, and the records after it are not read |
S: TP WI.CDR, FLAG.CDR, MENU.CDR and DRINKS.CDR; the order checked against the picture of MENU.CDR |
sample |
| R43 | A drawn object of version 1 or 2: a point (two i16) at byte 32; six i32 in 16.16 fixed point at 36, a b tx c d ty, with x' = a x + b y + tx + the point's x and y' = c x + d y + ty + the point's y; the object type at 60 (0 rectangle, 1 ellipse, 2 curve, 3 text); a byte at 67 that is not 0 when the object is outlined, the outline's width (u16) at 68 and its color at 74; the fill type (0 none, 1 uniform) and its color after it, at 94 and 95 with the marker e and at 105 and 106 with l and m; the shape from byte 114 with e and 136 with l and m. Colors are as R36 |
S: TP WI.CDR (e), FLAG.CDR (m) and MENU.CDR (l), checked against the pictures of FLAG.CDR and MENU.CDR |
sample |
| R44 | Shapes of version 1 or 2: a rectangle's width and height (i16), then a corner radius; an ellipse's width and height, then two angles; a curve's point list as R39 and R16 | S: rectangles in TP FLAG.CDR, ellipses and curves in TP WI.CDR, curves in TP MENU.CDR |
sample (the radius of files with the marker e, which no sample shows, and how the angles make an arc: unconfirmed; a radius is kept only when it is at most half the shorter side, and an ellipse whose angles differ is left out with a warning) |
| R45 | LIST stlt from version 7: a u32 style count, and when it is not 0: the fill table (a u32 count, entries of a table id, 4 bytes and a fild id, 12 bytes each, 60 from version 13), the outline table (12-byte entries laid out the same way, naming outl ids), the text tables (fonts of 44 bytes, 60 from version 10; alignments of 12; spacings of 52; tables of 152 and 784; bullets whose length a u32 inside them sets; indents of 28; hyphenation of 32, 36 from 13; drop caps of 28; from 8.01 a table of 12), then the styles: kind (u32), id, parent id, 8 bytes, name length and name (bytes before 12, UTF-16 units from it), the fill and outline table ids, then 16 bytes (20 from 8.01) for kinds above 1 and 20 more for kinds above 2. An object names its style in argument 200 (u16 before version 6, u32 from it). An object without argument 20 or 10 takes the fill or outline of its style; a style whose table id is 0 takes its parent's |
K L593-L600, L852, L1926-L2198; S: UC outl_width_cdr7.cdr, one of whose lines carries argument 200 and neither 10 nor 20 and names the style whose outline is black and 0.003 inch wide and whose fill is none, as the file's picture shows; the table parses exactly to the end of the list in each of the 498 sample files of versions 7 to 15 that has one, and every object with argument 200 in them names a style whose table ids are in the tables; argument 200 is 2 bytes on all 844 objects of versions 4 and 5 in the sample files that carry it, and 4 bytes on all 18 of version 6 |
public-spec (what the table ids name, and that an object takes its style's fill and outline: sample; a style taking its parent's entry: unconfirmed, as only text styles in the samples leave theirs to the parent, and a wrong guess draws a shape without that fill or outline) |
| R46 | A clipping container carries argument 8005; its first u32 is the id that the spnd chunk (a u32, a u16 before version 6) of one LIST grp in the document's LIST clpt holds. That group's objects are the ones the container clips; they keep their own transforms, in page space like the container's |
K L252, L860-L862, L1895-L1901 (the argument and the chunk); S: LT powerclipsquare_blackfill_whiterectangleinside of testset/12 to testset/25 and eight UC files of versions 7 to 13, in each of which the id in argument 8005 matches one group's spnd; in the UC file of version 7 the group's box, -1.96 to 1.97 inches across, overlaps the container's, -1.81 to 1.84 inches, and the file's picture shows the group cut to the container |
public-spec (what the id names, and the space of the group's objects: sample) |
| R47 | Argument 8000 marks an object seen through: a lens or a transparency. From version 13 it holds records of a u32 version, a u32 length and a body; a body of version 1300 that is 117 bytes long holds an f64 at byte 61 and a merge mode byte at byte 77, which the reader applies as a uniform transparency. VectorCraft reads the f64 as the transparency in percent (0 opaque, 100 clear) and maps the merge modes 0 normal, 9 multiply, 11 lighten, 12 darken, 14 color, 15 hue, 16 saturation, 17 luminosity, 24 difference, 28 screen, 29 overlay, 30 soft light, 31 hard light, 33 color dodge, 34 color burn and 36 exclusion to its blend modes. Other merge modes, other records (a lens record of version 13 is 84 bytes) and the argument before version 13 are not applied, and the reader names them with lenses in the warnings | K L859 (the argument); KF L707-L798 (the records, the 117-byte body and the merge modes); S: the version 1300 record of LT square_blackfill_nooutline_transparency50percent of testset/15 to testset/25 is 117 bytes long, with 50.0 at byte 61 and 0 at byte 77; the lens records of UC corel_lens_test_x3.cdr (13) are 84 bytes long; of the sample files of versions 7 to 25, the argument is on the see-through objects that the pictures of LT square_blackfill_nooutline_transparency50percent of testset/12 to testset/25, TDF 80103 and eight UC lens test files of versions 7 to 13 show, and otherwise only on text in UC fancytext_cdr7.cdr to fancytext_x3.cdr and on two objects of TDF 114901. The value K reads at byte 10 (14 from version 13) is not the transparency in these samples |
public-spec (the argument: K; what it marks: sample; the direction of the value: VectorCraft's own reading, as every sample is at 50%, and a wrong reading shows a 25% transparency at 75%; the layout before version 13: unconfirmed, and it is not read) |
| R48 | Bit 2 (0x04) of the outline's line type marks the outline dashed; the dashes of an outline without it are not drawn | S: every outline of versions 6 to 25 in the sample files with that bit set (316 of them, in 29 files) stores dashes; TDF 76771 (version 15) stores dashes 2 and 1 in an outline of line type 0x22, and the file's picture draws that outline solid | sample |
| R49 | Bit 4 (0x10) of the outline's line type puts the outline behind the fill | S: UC outl_behind_fill_cdr7.cdr to outl_behind_fill_x3.cdr, whose outline of line type 0x12 the file's picture shows behind the fill, and whose other outlines (0x02) it shows over the fill |
sample |
| R50 | Bit 5 (0x20) of the outline's line type scales the outline's width and dashes with the shape's matrix. The engine multiplies them by the square root of the matrix's area factor (VectorCraft's own value for a matrix that scales x and y differently) | S: UC outl_scale_with_cdr7.cdr to outl_scale_with_cdr12.cdr, of whose outlines only one, 3.969 mm wide, has line type 0x22 and the others 0x02 or 0x01; TDF 76771 (version 15), whose outline of line type 0x22 is 10 mm wide on a shape that the matrix stretches and skews, and whose picture draws that outline several times wider and skewed |
sample (the bit; the single width for a matrix that scales x and y differently: VectorCraft's own) |
| R51 | A trfd offsets table holds one offset more than the entries; each entry runs from its offset to the next, and the last offset is the record's end |
KF L1079, L1113-L1121; S: every trfd of versions 4 to 25 in the sample files (25,425 records) has the extra offset, equal to the record's length |
public-spec |
| R52 | Byte 0 of argument 14001 is the fill's winding flag. VectorCraft reads a byte other than 0 as the nonzero fill rule, and 0 or an object without the argument as even-odd | KF L575-L583, L1047; S: the argument is 4 bytes in the sample files that carry it, with byte 0 = 1 on LT complexshape_blackfill_nooutline of testset/12 and testset/15 to testset/25 and on objects of TDF 127576 (13) and 60026 (14), and 0 on 27 objects of TP example.cdr (17) |
public-spec (the flag: KF; which rule each value means, and the rule without the argument: VectorCraft's own reading, and a wrong reading fills or leaves holes where a curve's subpaths overlap) |
| R53 | A .cmx file is a RIFF form of type CMX1, little-endian (a RIFX form is big-endian and is refused); its chunks are laid out as R4. A chunk can run short of its contents: when the bytes after it don't read as a chunk id (an ASCII letter, then three ASCII letters, digits or spaces), the next id is the first at an even distance of 2 to 64 bytes that names a chunk the reader uses or whose length keeps it inside its list (VectorCraft's own rule) |
CN "Container"; S: all 14 CX files are RIFF forms of type CMX1; in balloon.cmx, bars.cmx, bluecros.cmx, bluedrop.cmx, gold_bar.cmx, goldblue.cmx, squares.cmx and thatch.cmx 16 bytes follow ccmm and 4 follow rlst before the next id |
sample |
| R54 | cont: byte 52 is the coordinate size as an ASCII digit, 4 for 32-bit coordinates and 2 for 16-bit ones (refused); bytes 64 to 72 hold an f64, the size of a coordinate unit in meters. A value that isn't above 0 and at most 1 reads as 0.1 µm (VectorCraft's own fallback) |
CN "Container"; S: the nine CX files with 4 all hold 1e-7; abydos.cmx, CM33.CMX, LIZARDS.CMX, output.000.cmx and test.cmx hold 2 |
sample |
| R55 | A table (rclr, rpen, rott, rdot, rotl) is a u16 entry count, then one field list per entry; an instruction's body is field lists too. A field is a u8 tag, a u16 length counting its 3 header bytes, and the data; 0xff ends the list. Objects name table entries from 1 |
CN "Tables"; S: every one of these tables in the nine CX files with 32-bit coordinates reads its count of entries with no bytes left | sample |
| R56 | A color entry: a property list in field 10 (a u32 length, then parts laid out as R11's, the color in part 1 as R14), or in older files the model and palette bytes in field 1 and the values in field 2. Models of the older fields: 2 cyan, magenta, yellow and black in percent; 3 the same in 0 to 255; 4 cyan, magenta and yellow in 0 to 255; 5 red, green and blue in 0 to 255; 9 gray in 0 to 255, 255 white. Other models read as black with a warning | CN "Tables" (rclr); S: every color of the nine CX files is model 2 in the older fields |
sample (model 2), public-notes (field 10), unconfirmed (models 3 and 5 of the older fields, read as the program of CN reads them, and models 4 and 9, read as R14's; a wrong reading gives a wrong color) |
| R57 | rpen field 1: the width as a u32 in coordinate units (then an aspect, an angle and a matrix, not read). rott field 1: a flags byte (1 no outline, 2 solid, 4 dashed, 8 behind the fill, 16 scaled with the object), then the caps in the low 4 bits and the join in the high 4 bits, numbered as R12. rdot field 1: a u16 count, then the dash and gap lengths in outline widths (u16 each). A pattern whose lengths are all 0 draws a solid line, as R48's |
CN "Tables"; S: line types 0x02 and 0x22 with caps and joins 0x00, 0x01 and 0x11 in the CX files | public-notes (the flags 4, 8 and 16 and the cap and join numbering; bit 0x20, set in balloon.cmx, is not read) |
| R58 | rotl field 1: six u16, the 1-based entries of the outline's line type, screen, color, arrowhead pair, pen and dash pattern |
CN "Tables"; S: every rotl entry of the CX files names entries that exist |
sample |
| R59 | rota: a u16 count, then pairs of u16 (start and end arrowheads, 0 for none), not field lists |
CN "Tables"; S: rota is 01 00 00 00 00 00 in every CX file |
sample (pairs of 0), public-notes (other values) |
| R60 | A page chunk is a stream of instructions: a u16 size counting the whole instruction and an i16 code, or 0xFFFF, a u32 size and the code (the long form); then field lists. Codes: 9 and 10 begin and end a page, 11 and 12 a layer, 13 and 14 a group, 67 a curve; 20 and 21 a text object, 65 its drawn characters, 66 an ellipse, 68 a rectangle, 69 an image, 88 and 89 add and remove a clipping path, 111 a jump whose field 1 is the u32 file offset to go on from (the bytes jumped over hold images). Objects are drawn in file order, the first at the back |
CN "page: instructions"; S: codes 9 to 14 and 67 in the CX files; in squares.cmx the large square comes first and the two smaller ones inside it after |
sample (9 to 14, 67, the order), public-notes (the long form and the other codes) |
| R61 | Field 4 of instruction 9: the page's width and height, u32 each in coordinate units. Without it, field 1 gives the drawing's bounds: a u16 page number, a u32, then the left, top, right and bottom edges as i32 in coordinate units; the page takes the bounds' size and is centered on them (VectorCraft's own choice). Without either, the page has no size, and the importer gives it 612 × 792 pt as it does a .cdr page without one (VectorCraft's own size) |
CN "page: instructions"; S: none of the CX files has field 4; in all nine with 32-bit coordinates, the four edges in field 1 match the extent of the file's curves | public-notes (field 4), sample (field 1) |
| R62 | A layer's name: field 4 as a u32 count and UTF-16 units, or field 1 from byte 12 as a u16 count and 8-bit characters (read as Windows-1252, VectorCraft's own choice); a layer without a name is left unnamed, as a .cdr layer is. A curve: field 1 its rendering attributes, field 2 a u16 point count, the points as i32 x and y, then a type byte for each as R16; coordinates are from the page's center, y up. A field 2 too short for its count is read as whole points with their type bytes when its length is a multiple of 9, and the curve is left out as damaged otherwise (VectorCraft's own rule) |
CN "page: instructions" and "Coordinates"; S: the 8-bit names Layer 1, Desktop, Grid and Guides of the CX files (the last three hold nothing in every file); every curve of the CX files has field 2 of exactly 2 + 9 bytes per point |
sample (8-bit names, curves), public-notes (field 4) |
| R63 | Rendering attributes: a mask (1 fill, 2 outline, 4 lens, 8 canvas, 16 container; lenses, canvases and containers are not read, with a warning), then a field list for the fill when the mask names it and one for the outline. The fill's field 1 is a u16 type and a field list; type 0 is no fill, type 1 a uniform fill whose field 1 is the color entry (u16) and a screen (u16); other types (2 fountain and more) are not read. The outline's field 1 is its rotl entry (u16) |
CN "Rendering attributes"; S: masks 1, 2 and 3, fill types 1, 2 and 6, and uniform fills with a 4-byte field 1 in the CX files | sample |