Commit Graph
23 Commits
Author SHA1 Message Date
dotCooCoo 1c5f97acfc File formats: .cmx gray and CMY colors, unnamed layers, stricter chunk search
- Colors in the older color fields read gray (model 9) and CMY (model 4)
  as the .cdr reader numbers them, instead of opening as black.
- A dash pattern whose lengths are all 0 draws a solid line, as for a
  .cdr outline.
- A curve whose point field is too short for its count and is not whole
  points with their type bytes is left out as damaged, instead of reading
  coordinates as point types.
- A layer without a name comes in unnamed, and the importer names it by
  its place, as for a .cdr drawing.
- After stray bytes, a chunk id starts with a letter and may hold digits
  and spaces, and the id found must name a chunk the reader uses or have
  a length that fits its list. Padding is no longer taken for a chunk.
- A canvas or a container in an object's attributes gives the
  unsupported-objects warning.
- A page with no size and no bounds is 612 x 792 pt, VectorCraft's own
  size, as for a .cdr page; PROVENANCE R61 says so. PROVENANCE also names
  the other program's .cmx reader, read for field order.
2026-11-18 17:54:13 -08:00
dotCooCoo c7d78a2dac File formats: open and place .cmx files
.cmx exchange files with 32-bit coordinates open and place as editable
art. vectorcraft-cdr reads the RIFF form CMX1, its header, the color,
pen, line type, dash, outline and arrowhead tables, and each page's
instructions in drawing order, into the drawing model the .cdr reader
uses, so the importer maps pages, layers, groups and curves with uniform
fills and outlines the same way. A layer that holds nothing is left out.
A page that gives no size of its own takes the size of the drawing's
bounds, which the page header stores, and is centered on them.

Text, images, rectangles, ellipses, clipping paths, fills other than
uniform ones and arrowheads are left out, and lenses are not applied;
the warnings name each kind, with rows in every complete catalog.
Big-endian files and files with 16-bit coordinates are refused with a
message. Layouts and their sources are rows R53 to R63 of
crates/cdr/PROVENANCE.md; tests use synthetic files only.
2026-11-18 15:52:44 -08:00
dotCooCoo 5c28beca75 CDR import: a fill or outline whose record is missing is damage
A shape that names a fill or outline id no record has comes in without that paint and with the damage warning, so the open counts as lossy. Id 0 without a record stays no paint.
2026-11-14 17:40:04 -08:00
dotCooCoo ca804d921e CDR import: hidden and locked art, fill rule, outline spot colors and uniform transparency
- Layers, groups and objects open hidden and locked from their flags (bit
  0x01 of byte 1, bit 0x10 of byte 0). Layers of one name merged across
  pages are hidden or locked only when all of them are; otherwise their
  art is, object by object. A clipped group's flags reach its objects.
  Hidden guidelines go on a hidden "Hidden guides" layer, and the other
  guides on the top shown layer.
- Byte 0 of argument 14001 other than 0 fills the shape with the nonzero
  rule; other shapes stay even-odd.
- From version 13 an outline's property list record that names a library
  color gives the outline that spot color.
- From version 13 a uniform transparency (a 117-byte record of version
  1300 in argument 8000) becomes the object's opacity, read as the
  transparency in percent, and its merge mode the blend mode where one
  matches. Lenses, other records and other merge modes keep the warning.
- A cdr8 file is the 8.01 variant whatever its vrsn chunk names. The
  argument 200 style id and the spnd id are u16 before version 6. A trfd
  entry ends at the next offset. A version 15 corner radius is held to
  half the shorter side.
- PROVENANCE.md adds source KF, the MIT-licensed fork of the
  specification by Zach Wolfe, and rows R51 and R52; LICENSE-kaitai.txt
  and NOTICE credit it.
2026-11-14 16:31:24 -08:00
dotCooCoo 0adb013041 CDR import: outlines set to scale with the object scale with its matrix
Bit 5 of an outline's line type marks it to scale with the object. Such an
outline's width and dashes are now multiplied by the square root of the
area factor of the shape's matrix, instead of keeping their stored width
(PROVENANCE.md R50). Other outlines keep their stored width.
2026-11-13 20:35:11 -08:00
dotCooCoo 7e89bf330d CDR import: keep the children read before a list is cut short
A list whose length runs past the end of its parent, as in a file cut
off inside its last page, now keeps the bytes it has, with the damage
warning. Its complete children before the cut are read; other chunks
that run past the end are still left out.
2026-11-12 19:23:25 -08:00
dotCooCoo daeb83d2ee CDR import: bound the walks of clipped groups and stop copying refused dashes
Every chunk walked inside a clipped group now counts toward a new
clipped_chunks limit (2,000,000), each time a container names the group,
empty groups included. Containers that all name one group of empty
groups took time in the product of the two counts; past the limit a
container's group is left out, with its guidelines, and the container
stays as a plain shape with the limit warning.

An outline record refused at the dash limit drops its dashes from the
cache, so later shapes that use it take it solid without copying the
dash list.
2026-11-12 19:04:31 -08:00
dotCooCoo c2789fff2a CDR import: report id arguments cut short and resolve styles in linear time
A container, fill, outline or style argument too short for the record id
it names now adds the damage warning. Before, a container argument of
fewer than four bytes imported the container alone and dropped the
objects it clips without a warning.

Resolving the style table's parent chains now removes each walk's styles
from the visited set one by one instead of clearing the set, whose cost
grew with its capacity after one long chain.
2026-11-12 18:30:51 -08:00
dotCooCoo 206f36f1df .cdr import: describe clipping containers and their sources by what they hold
The docs, comments and PROVENANCE.md rows R45 to R48 name clipping
containers by what they do, and cite the sample files without a vendor
prefix in their names.
2026-11-12 14:42:54 -08:00
dotCooCoo fdbdbe8696 .cdr import: read the chunks of a style list before version 7
Before version 7 a LIST stlt holds chunks, not the style table, but the
index left every such list unsplit, so fills and outlines kept there
were not found. The index now splits it by the drawing's version, the
one its first vrsn chunk names, once all of the file's own chunks are
read.
2026-11-12 14:27:57 -08:00
dotCooCoo 75ac55b32a .cdr import: an ellipse of version 1 or 2 without its angles is damage
A drawn ellipse whose record ends before its two angles came in as a
whole ellipse with no warning; it is now left out as damage. The file
format table now says that version 3 envelopes are not applied and the
objects under them are kept, and gives one count of the formats opened.
PROVENANCE.md, the crate README and docs/mcp.md now say which parts of
versions 1 to 4 public specifications cover.
2026-11-12 14:07:48 -08:00
dotCooCoo f940e5e0f2 .cdr import: fuzz mutated drawings with styles and clipping containers, and place them
The importer's fuzz test of mutated RIFF drawings now also starts from a
drawing with a style table, a clipping container, an outline behind the fill and
a lens, and places each mutated drawing as well as opening it.
2026-11-12 14:03:22 -08:00
dotCooCoo 5da5317c6c .cdr import: integration tests build as one test binary
The crate's integration tests move to tests/it, one module per area,
built as a single test binary as the other crates' are. The file format
table now lists clipping containers, fills and outlines taken from the object's
style, and the lenses warning.
2026-11-12 13:56:50 -08:00
dotCooCoo e71ab08233 .cdr import: bytes a failing compressed stream inflated count toward the limit
A zlib stream that fails near its end has already inflated most of its
bytes, which the reader discarded without counting them. Several such
streams could each inflate up to the file's inflate limit. Those bytes
now count toward it.
2026-11-12 13:40:48 -08:00
dotCooCoo 08155e34e3 .cdr import: a shape left out at the coordinate limit is not damage
A curve or polygon whose points go past the coordinate limit was left
out with both the limit warning and the damage warning, in RIFF files
and in files of versions 1 and 2. It now gives the limit warning only.
A polygon without its sides argument is still damage.
2026-11-12 13:37:48 -08:00
dotCooCoo 712e567a95 .cdr import: outlines behind the fill come in below the fill
Bit 0x10 of an outline's line type puts the outline behind the fill, so
that a filled shape shows only its outer half. The reader now reports
it, and the importer paints such a stroke before the fill. A clipping
container's outline behind its fill becomes a stroke of its own below
the clipping group, the two grouped together, since a clipping path's
stroke paints over the clipped objects. PROVENANCE.md row R49 gives the
sample files.
2026-11-12 13:33:33 -08:00
dotCooCoo f8ad4565d0 .cdr import: an outline is dashed only when its line type says so
Bit 0x04 of an outline's line type marks it dashed. Some drawings store
dashes in outlines without that bit, and their own preview pictures show
those outlines solid; the reader drew them dashed. Such outlines now
come in solid. PROVENANCE.md row R48 gives the sample files.
2026-11-12 12:52:45 -08:00
dotCooCoo 907ca62d62 .cdr import: name lenses and object transparency in the warnings
An object with a lens or a transparency carries argument 8000. The
reader does not apply it, and the object comes in opaque; the warnings
now say so instead of nothing. PROVENANCE.md row R47 lists the sample
files that carry the argument.
2026-11-12 12:42:08 -08:00
dotCooCoo 4507c470e3 .cdr import: clipping containers clip the objects they hold
A container carries argument 8005, whose id names the LIST grp of the
document's LIST clpt with the same id in its spnd chunk. The reader now
gives the container with that group's objects, which keep their own
transforms, and the importer makes a clipping group of them: the
container's shape is the clipping path and keeps its fill and outline.
Before, only the container came in, with no warning.

A container whose group is missing is damage. A group already being
read, or more than 64 clipped groups one inside another, is left out
with the limit warning; the container stays as a plain shape either way.
PROVENANCE.md row R46 gives the layout and the sample files it was
checked against.
2026-11-12 12:26:53 -08:00
dotCooCoo 977b5773c3 .cdr import: bit 0x10 of a layer's flags no longer makes it a grid
A layer without a loda of its own is taken by the low four bits of its
flags' byte 0: 0x0a guides, or a grid when bit 0x10 is also set, and
0x08 the desktop only when byte 2 is set. Sample files flag drawing
layers 0x10, 0x18 and 0x58 with byte 2 clear, which the reader took for
grid layers and left out, and 0x08 with byte 2 clear, which it took for
the desktop.
2026-11-12 12:04:20 -08:00
dotCooCoo 2cd5ad52d1 .cdr import: objects without their own fill or outline take their style's
From version 7 a drawing keeps its styles in LIST stlt, and an object
names its style in argument 200. An object without a fill (20) or
outline (10) argument of its own now takes the fill and outline its
style gives, through the style's parents where the style leaves one to
them. Before, such objects came in without a fill or outline.

The table is read only when it parses to the end of its list; a table
that does not is damage when an object needs a style from it. Its
entries and styles count toward the chunk limit. PROVENANCE.md row R45
gives the layout and the sample files it was checked against.
2026-11-12 12:01:08 -08:00
dotCooCoo 4c8cfda86a .cdr import: read layouts as public sample files store them
Version 2 files (markers m and l) start their settings after a 1-bit
picture, so the page box is read two bytes after the settings offset in
the header, and their drawn objects keep the fill at byte 105 and the
shape at 136. Files with the marker l flag drawn objects 0xc0 and are now
read; the marker d, which no sample shows, is refused. A record that does
not start with 24, or a drawn object of an unknown type, ends the walk
instead of reading the bytes after it as records. A rectangle's radius
follows its height directly.

A layer's kind comes from the object type in its own loda (11 grid,
12 guides, 17 desktop), so drawing layers flagged 0x10 or 0x08 are no
longer dropped or taken for the desktop. Object type 0x25 is read as a
path from version 10, and arrowhead ids are looked for from version 6.

PROVENANCE.md now cites the Kaitai specification, the ZIP specification,
the file utility's magic, PRONOM and the public sample files whose bytes
each row was checked against.
2026-11-12 11:38:11 -08:00
dotCooCoo 59db4313b1 File formats: open and place .cdr drawings, versions 1 to 27
File › Open and File › Place read .cdr drawings of versions 1 to 27,
and .cdt templates open as new untitled documents. A new L0 crate,
vectorcraft-cdr, reads the WL files of versions 1 and 2, the RIFF chunk
tree of versions 3 on with its compressed lists, and the ZIP packages of
versions 14 on with their data streams. The importer maps pages to
artboards side by side, layers by name, the master page's guidelines to
guides, groups, curves, paths, rectangles, ellipses, arcs and polygons
with uniform fills and outlines.

Versions 1 and 2 open as one page and one layer of rectangles, whole
ellipses and curves. Version 3 keeps transforms, fills and outlines in
each object, and a group's matrix places its objects; envelopes are not
applied, with a warning. Version 4 reads as version 5 with 12-byte u16
colors and fixed-point transforms.

Text, bitmaps, blends, contours, brush strokes, fountain, pattern,
texture and PostScript fills and arrowheads are left out, and the open
warnings name each kind in every complete catalog. RIFF files that name
a version before 3, drawings after 27 and encrypted, ZIP64 or split
packages are refused with a message. crates/cdr/PROVENANCE.md lists the
public source of each record layout.
2026-11-12 09:03:17 -08:00