When the orientation the record names didn't lay the steps out turned
as drawn, the import took the orientation whose steps sit closest to
the drawn ones by their centers alone. A half turn leaves the centers
in place, so a blend drawn Align to Path whose record named Align to
Page came in as Align to Page, with each step turned from its drawing.
The import now takes the closest of the orientations that pass the
check, and the closest of them all only when neither passes.
Test: grouped red and blue squares drawn turned on a spine running
right to left come in as Align to Path with a record naming either
orientation.
The check that the record's orientation lays the steps out as drawn
compared a step's outline as one set of lines. A half turn of a group
of a red square beside a blue one keeps that outline and trades the
squares' places, so such a blend passed as Align to Path. Each subpath
is now compared with the other's subpaths of a matching fill; a compound
path's members take its fill, and gradient or pattern fills are compared
with each other by their outline.
The check also tries the laid steps nearest first when it compares
outlines. Before, every step in place was compared, so a hundred steps
crowded within the tolerance used up the outline comparisons on the
first one and the check failed.
Tests: grouped red and blue squares on a spine running right to left,
drawn unturned, keep Align to Page with a record naming either
orientation, and keep Align to Path when drawn turned; a group of a
gradient-filled triangle turned a half turn doesn't match; a hundred
crowded steps match their drawn copies; 998 crowded steps keep Align to
Page.
With more than 16 drawn steps, the check compared the outlines of the
first 16 it tried and took the rest by their sizes, so a last step drawn
turned the other way still matched. It now compares the outlines of 16
steps spread evenly from the first to the last. A step that would take
more than 64 outline comparisons matches none, so the record's
orientation is not taken on an outline that was not compared.
The check that keeps a record's orientation compared two outlines by
their anchors alone. A square with its top side bent inward has the same
corners as its half turn, so the two matched. The check now also
compares the points a quarter, half and three quarters along each
segment, in both directions.
Opening a .ai from its editing data alone checked whether the text
document makes all of its type, then built the document, and each step
decoded and parsed the text document and scanned the text objects'
frames again. A file with envelopes of type, which waits on its PDF
part, did this up to four times.
The check and the builds now share one read of the frames and of the
text document. It is kept with the decoded editing data for the build
with the PDF part and for the build without it that can follow, also
when the check failed. The build applies its own pattern paints to the
shared text document, as before.
The document and notes are unchanged: new tests compare them against
the same opens with every check and build reading the text afresh, and
count one read and one scan on each route.
Two settings of a blend read from the editing data came from rounding
instead of from the file:
- The orientation was whichever of Align to Page and Align to Path laid
the steps out closer to where they are drawn. The check compares the
steps' centers, which turning the steps along the spine leaves in
place, so on a straight spine both fit and the rounding of the drawn
steps decided. The reader now reads the record's word 5 (0 is Align to
Page; a 32-bit float of 8 or more is Align to Path) and keeps that
orientation when it lays the steps out as drawn: in place, at their
drawn sizes and with each one's outline where it is drawn, which
turning a step moves. Otherwise it takes the closest, as before.
- A blend with no spine part opened with a straight spine and an anchor
at each key. When its record names the keys in their order, it now
opens with no spine of its own, which lays out the same straight
lines between the keys' centers. A record that names them in another
order still gets the straight spine in the record's order.
Blend Options, orientation and spines:
https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-options-overview.html
Tests: the record's word 5 (0, 8, 8 plus an angle, and values that name
no orientation); the record's orientation kept where both lay out alike,
and not taken where it would turn the drawn steps (rectangles on a
vertical spine, triangles on a spine running right to left); outlines
that match whatever anchor a path starts at, with another anchor on a
side, with contours in another order and with a lone anchor, and live
art compared by its size; a blend with no spine part in record order
and in the other order.
Saving a legacy .ai file numbered a gradient definition whose name was
taken by searching every definition written so far for each number it
tried, so a document with many distinct gradients without a swatch name
spent time cubic in their count naming them. Spot color names were
numbered the same way.
Both now keep the names given in a set and, for each name, the number to
try next. Names are never given back, so every number below that counter
is still taken, and the file is the same as before: the first free
"Name 2", "Name 3" and so on, with equal gradients sharing a definition.
- New tests compare the counters with a search of the names given over
3,000 names, and the whole written file both ways for colliding
gradient and spot color names.
- An ignored timing test writes 1,504 gradient definitions: in release on
Linux, the median of 7 runs took 23 ms of thread CPU time against
1,163 ms for the search.
A series read from bands with unstroked markers, or bands alone, kept an
explicit no-stroke paint. With Draw Filled Lines turned off, the thin line
took that paint and was not drawn. Such a series now keeps no stroke, as a
graph drawn here does, and its thin line is drawn in the series color at
1 pt. A series whose markers carry a stroke keeps it.
readhexstring and readline called the one-byte file read for every input
character, copying each byte into a new vector. They now scan the bytes
left in the file in one slice and advance the file by the bytes they used.
The results are unchanged: the same bytes, the same boolean, the same next
unread byte, from the program's own file (after the whitespace that ends
the last token), a decoded buffer and a filter decoded when first read.
readhexstring stops on the digit that completes the last byte and drops a
lone digit at the end of the data; readline takes CR LF as one line ending,
leaves the byte after a lone CR unread, and leaves the line ending unread
when the line fills the string.
Tests run the new readers next to copies of the byte-at-a-time loops over
13 stream forms and several hundred inputs, comparing the result and
everything left to read; an image read through a readhexstring procedure
is compared with the same samples given as a hexadecimal string. The
import fuzz tests gain readline and a case for both operators.
data_op allows clippy::cognitive_complexity. Without the allow, clippy
rates it 54 against the limit of 30; with the old loops in place it
passes.
A line graph whose style record draws its lines as shapes now opens as a
live graph with Draw Filled Lines on, and its lineShapeWidth becomes the
Line Width (3 pt reads as the default). The flag is ignored when the
points are not connected, as the published file format specification
says (printed pp. 147-148). Saving writes both values in the Gy record.
- Widths from 0.01 to 100 pt are kept. A wider Line Width, a width under
0.01 pt with filled lines, and filled lines without connected points
are saved as the graph's art with the existing warning.
- In a filled-line series, a filled path with the thin black band
outline is read as a band and does not set the series stroke. A
filled path with another outline must be a square marker or legend
swatch; otherwise the graph keeps its art as plain objects.
- The reader in crates/eps/src/import/ai/read/graph.rs reads each value
the writer in crates/eps/src/ai_graph.rs writes; the save-then-open
tests cover the default, 8 pt and 150 pt widths in both .ai forms.
xtask pdf-deps still expected craft-pdf and the patched hayro/krilla
backends at main's 9be9a637 revision after this branch pinned them to
a499742a. Point REV at that pin (still on craft-libs main). Classify
test files in sonar-project.properties the way craft-libs does, so the
quality gate measures the product. Give the EPS operation-budget test
the same 300s cap as the other budget tests; under instrumented coverage
it overran the old 120s cap, while the Ubuntu gate finished in time.
A gradient definition in the .ai editing data holds each stop's color, opacity, midpoint and ramp point, and VectorCraft's reader opens it as a Classic gradient. A Perceptual gradient was written with its own stops, so the file opened with different colors between them.
The writer now treats a Perceptual gradient as it treats a gradient mixed around the hue wheel, in the art and in the Swatches panel: the colors on its curve become stops of their own in process colors, at most 256, with a warning that names Perceptual gradients. A stop linked to a global process color reports its lost link for both methods. Dither is reported as its own loss. A freeform gradient, or one with more than 256 stops, is still written as its average color whatever its method.
A stored texture longer than the codec's default 2^18-pixel side still
reads back, and a gray PNG is not expanded to RGBA just to get its
levels. The AI writer and the EPS scene refuse an oversized image from
its header, then decode within MAX_IMAGE_PIXELS, keeping the pixels at
their stored depth. Flatten's see-through check uses ImageBlob's
allowance, and links.unembed decodes within MAX_RASTER_ALLOC.
A clipping object written as art cut to it (a group, an image, a symbol
instance, a live object, type, or a path inside art already cut to
another clipping object) lost its name, opacity mask and variable
bindings in the editing data: no written object carried its dictionary,
and a painted one put its name on each of its fill and stroke objects.
The unpainted path that carried its text wrap options now carries its
whole dictionary, in the form the .ai reader reads (art_dictionary in
crates/eps/src/import/ai/read/document.rs). Its fills and strokes keep
only the opacity mask they are drawn through. The path is admitted by
the object count, so at the object limit its dictionary is never left
on the object before it, and a path whose dictionary comes out empty is
taken out again.
Remove Background and Color Mask check the image's size from its header
again before decoding ("an image of W × H pixels is too large to change"),
and Crop Image's trim and Remove Background read a file that can't hold
the pixels its header declares as unreadable, as on main. The test helper
reading Remove Background's output keeps 16-bit samples.
The HEIF and JPEG XL readers and their tests go back to main's (heic-rs and
jxl-oxide): the craft-heif and craft-jxl versions failed eight of their
tests (resolution axes after a quarter turn, the container's mirror and
crop, refusing a grid of cropped tiles, 16-bit samples, the decode
allowance). Moving them stays to do.
EPS fax images decode with craft_stream_codecs::decode_ccitt_raw instead
of hayro-ccitt directly. With EndOfBlock the rows end at the end-of-block
code whatever Rows says (rows 0), as before. Needs craft-libs#1772
(rows on bytes exactly as EncodedByteAlign says).
Area type with wrap shapes was always written as outlines in the editing
data for other apps. It is now written as type when the reader works the
same wrap out again from the objects above it: each wrap object is a path
of one subpath, a compound path of visible members, or an unclipped group
of such objects, with no paint, or a solid fill, a plain solid stroke or
both, without effects, art style, opacity mask or clipping, with an
offset within -1000 to 1000 pt; the type's stored shapes match the ones
those objects give it; and the shapes of all area type stay within the
2,000,000 anchors the reader copies. Each frame of a thread is checked on
its own. When art is left out at the object limit, such type is written
as outlines again. Other wrapped area type stays outlines.
The reader recomputes the wrap with resolve_wrap after reading
(resolve_text_wrap in crates/eps/src/import/native/build.rs) and reads the
options with text_wrap in crates/eps/src/import/ai/read/document.rs; the
round-trip tests check the reopened characters, frame, wrap shapes and
wrap objects. resolve_wrap's layer walk is shared through a new
wrap_sources so the check follows the same traversal.
Graph Type has a Line Width field next to Draw Filled Lines, and
`graph.setType` takes `lineWidth` in points (0.01 to 1000; 3 when the
graph sets none). Filled lines are drawn at that width, and the width is
kept through save and open. A graph stores a width only when it is not
3 pt, and a graph with a width of its own is written to .ai as its art.
`graph.setType` with options that leave the graph as it is records no
undo step.
EMF, WMF and SVG wrote a symbol instance from its symbol's art as stored,
so live effects inside that art were missing: a square moved 100 pt by a
Transform effect stayed in place in the file while the canvas drew it
moved. Art whose own place is off the artboard was left out even when
the effect moved it onto it.
These exports now call bake_document_placing_symbols, as PDF, print, EPS
and DXF do: each instance of a symbol whose art needs baking is written
as that art placed by the instance and then baked, so an instance that
scales or turns its art does not scale what its effects do. EMF and SVG
clip 9-slice cells and WMF does not, as each places other instances. In
SVG those instances are written as groups; instances of symbols without
such effects still share one <symbol>. Preserve Editing still embeds the
document with its live effects.
WrittenLayers gains hidden_objects. SVG sets it with Hidden Layers on,
since it then writes hidden objects too, so a hidden instance is written
hidden with its effects applied. The other exporters leave it off.
An SVG instance nested in another instance's art was shared through
<use> when the def allowed its own transform, while the <use> writes
that transform after the outer instances'. A stroked symbol nested in a
scaled instance then drew its stroke at double weight. The check now
uses the transform the <use> writes.
The editing copy of a large canvas wrote every envelope as its drawn
art. It now writes warp, mesh and top object envelopes live at 1/10 of
their size with the rest of the art, under the same checks as on a
normal canvas, and the reader opens them at their size from the editing
data alone or beside the PDF part.
Read from the editing data alone, a Large Canvas copy also gets:
- an envelope's saved box size compared with its contents at the
declared scale, so a bounds margin kept with Distort Appearance is no
longer lost;
- every path's stroke weight, dashes and dash offset at the declared
scale, not at 1/10.
- EPS CCITTFaxDecode goes back to hayro-ccitt (main's filters.rs and data.rs):
craft-stream-codecs decodes /K -1 /Columns 70 data to other rows
(eps import::tests_images::ccitt_fax_images_draw). DCTDecode is main's again.
- The AI editing writer decodes through the image crate again: going through
RGBA8 lost 16-bit sources, so their 8-bit warning disappeared
(ai_editing::tests::sixteen_bit_images_are_written_at_eight_bits).
- Crop Image refuses an image over its allowance by header size again, with
main's "an image of W × H pixels is too large to draw" message.
- Test fixes: colorized_images writes its gray PNGs gray again, and the PDF
16→8-bit test expects rounding, as the 8-bit copy is made.
craft_image_codecs::probe_size only reads WebP, EXR and the GIF/BMP/TGA family;
for PNG, JPEG and TIFF it returns Unsupported. The cutover used it for header
sizes, so DXF export left every PNG out (cad tests), plugin objects lost PNG
pixels, and EPS image-mask and SVG import fell back to decoding whole images to
learn their size. vectorcraft_doc::header_size reads PNG's IHDR and a JPEG's
frame through craft-image-codecs and other formats through the image crate's
header readers, as main does, without decoding pixels. The SVG filter's JPEG
size comes from jpeg_info instead of a full decode.
- Test files whose image→craft-image-codecs rewrites didn't compile against
main's newer tests go back to main's versions (engine fileio/tests.rs,
tests_tiffbmp.rs, tests/menucmds.rs, eps tests.rs); they still use the image
crate, which keeps its format features.
- craft_jxl::encode, craft_image_codecs::encode and Image::icc at d6cd7836d.
- jp2read and pdf export pass DecodeOptions, not Limits.
- EPS DCTDecode: grey JPEGs no longer use the image after moving it, and keep
main's one-channel output.
- svg keeps its direct usvg dependency for main's image href code; pdf keeps
jpeg-encoder for CMYK JPEGs.
- clippy -D warnings and rustfmt clean.
Conflicts resolved in favour of main/#7664 in the 13 source files both touched
(doc/cmyk.rs, metafile/dib.rs, pdf images, svg import/files.rs, render paint and
encode tests, trace, engine load.rs), keeping main's newer TIFF/CMYK, DIB and PDF
image fixes. vectorcraft-doc stays on main's version until its CMYK reader moves
to craft-tiff. The image crate keeps its format features, and usvg, tiff,
zune-jpeg, hayro-ccitt and jpeg-encoder stay for the readers not yet moved.
Codec crates pinned to craft-libs d6cd7836d364177661b0ae17f48a0805e83a5f32.
Also fixes the compile errors CodeRabbit flagged (jp2read DecodeOptions,
filters.rs use-after-move) and the encode() arity at d6cd7836d.