Files
vectorcraft/crates/eps
dotCooCoo de367486c0 .ai save: the editing copy keeps gradient meshes
The editing copy of a PDF-compatible .ai wrote every gradient mesh as
its drawn look. Meshes the .ai reader reads back as they are are now
written as meshes:

- Each mesh is a /Mesh record: 2 /Version, its type and grid size,
  /Data, then each patch row by row with its place, the color space
  where it changes (gray, RGB or CMYK) and its four corners: color,
  opacity, point, and the handles towards the next corner and the one
  before it. Its opacity, blending mode and knockout shape are set
  before the record, and its name and opacity mask follow it.
- A reflected mesh, whose patches all turn the other way, is written
  with its columns in reverse order, which draws the same mesh.
- In a symbol's art the corners are written about the canvas point of
  the ruler origin, y up, as an image's matrix there is. An envelope's
  grid in a symbol's art is now written in the same space, and the
  envelope's contents in its dictionary in the canvas's space, y down.
- Each mesh is checked with the reader's own reading before it is
  written. Written as their drawn look with a warning: meshes with a
  point in a Lab color, with more than 128 rows or columns, folded
  meshes (patches that turn different ways), meshes the reader would
  read with other points, handles or colors, meshes in pattern tiles
  and in art cut to a clipping object, and every mesh on a large
  canvas. A mesh's drawn look is written at any depth of nested
  symbols and live objects.

Each construct is written in the form the .ai reader at e142c5fcee
reads: /CS, /Type, /Size, /P, /N and /E in mesh.rs:180-234, corners
with or without an opacity by their count of values in read_corners
(mesh.rs:239), the patches joined into one mesh in one_mesh
(mesh.rs:298); /Mesh X!, X# and /End X! in read/ops.rs:219-232; the
transparency after the record in read/art.rs:281 (end_mesh) and
read/ops.rs:344. /Version and /Data are passed over by that reader
(mesh.rs:234). Corners in a symbol's art rest on a reader change in
this commit.

The reader changes how any .ai opens:

- Mesh records and envelope grids in a symbol's art are read in canvas
  space (read/document.rs:947 image_space), and an envelope's contents
  in its dictionary in the canvas's space, y down. In a file without a
  template box such a mesh is left unread, its symbol is not read
  whole, as with an image there (read/art.rs:634), and its instances
  open as the page draws them. Envelopes in symbols in .ai files saved
  by earlier VectorCraft builds open differently.
- A point of a patch whose corners differ in color model keeps its own
  color when the patches are joined into one mesh.

Gradient meshes, mesh points and their opacity:
https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=200
Patch meshes (corners joined by cubic edges with control points):
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf#page=321

Tests: the round trip of meshes with RGB, CMYK and gray points, a moved
point with handles of its own, part-transparent points, a name,
opacity, blending mode and knockout shape, hidden and locked, with an
inverted, unlinked opacity mask, in groups, opacity masks, symbols,
opacity masks in symbols, a document of two artboards and eight levels
down, compared point by point, handle by handle and channel by channel
at the 4 decimals written; reflected meshes, mirrored across and
along; the record's form, including corners in a symbol's art and an
envelope's grid and contents there; an envelope in a symbol read back
with its contents and their gradient in place; the same bytes on a
second write; each case written as its drawn look, with its paths read
back over the mesh's box; reading a mesh in a symbol's art with and
without a template box; /Version and /Data passed over; the color
model rule; fuzz cases for damaged written meshes, a symbol's
included.

Docs: docs/file-format-parity.md, docs/target-app-parity.md.
2026-11-16 13:44:56 -08:00
..