Gradients: keep every run of a repeated gradient with many stops

When a repeated or reflected gradient needs more stops than a limit
allows, each run now leaves out the stops that change its colors
least, so every run is still written, instead of writing fewer runs
and padding the rest with the last color. Each run keeps its ends,
sharp steps, swatch-linked stops, tint and CMYK ink changes and spans
shaped by an off-center midpoint, and the colors are compared as the
gradient's method mixes them. This applies to gradients along or across
a stroke, CSS conic gradients, and PDF, EPS and .ai export.

- Outline Stroke's mesh fits the gradient to at most 1,024 stops, and
  splits a stroke into several meshes when one would hold more than
  2^20 points.
- Object > Expand leaves a gradient as it is when the box needs more
  than 256 runs, instead of expanding only the first runs.
- CSS writes the stop positions of repeating gradients with four
  decimals, so the period stays in place across the box.
- A swatch chip of a gradient that repeats gets at least four grid
  cells a run along each side (at most one a point, and 128), so it
  does not show one color when the count matches the chip's cells.
- docs/mcp.md states the stop limits and the PDF import sample budget.
This commit is contained in:
dotCooCoo
2026-11-12 11:30:44 -08:00
parent 2304b38f19
commit 0691e1acbe
11 changed files with 411 additions and 40 deletions
+10 -5
View File
@@ -1204,11 +1204,16 @@ is written with its stops repeated as many times as the shape needs: at most 256
legacy `.ai`), and for a radial or diamond gradient no farther from its center than 65,536 runs, or than a million
times the smallest gap between its stops (measured in runs) when that is less. Past those it pads, with a warning.
The `.ai` editing data has no spread either: it holds the stops repeated across the shape, at most 256 of them, with
a warning. PDF import finds a sharp step between two colors in an axial or radial shading, in any PDF, by halving
the spans between its samples, so the step reads back where it is in the file (to 1/64 × 2^-14 of the axis, with at
most 16,384 samples a shading) instead of blurred across the samples around it. Object › Expand expands the
repeated stops, into the same whole number of `steps` objects for each run (at least one, so about `steps` in all),
each run starting on an object's edge:
a warning. When the runs need more stops than these limits allow, every run is still written, without the stops that
change its colors least (its ends, sharp steps and swatch-linked stops stay); the same applies to a gradient along
or across a stroke, and to CSS's conic gradient, past 16,384 stops, and to Outline Stroke's mesh past 1,024. PDF
import finds a sharp step between two colors in an axial or radial shading by halving the spans between its samples,
so the step reads back where it is in the file (to 1/64 × 2^-14 of the axis) instead of blurred across the samples
around it. A shading takes at most 16,384 samples, so the steps past the point where that budget runs out stay
blurred, and a color band narrower than 1/64 of the axis can be missed when no sample lands in it. Object › Expand
expands the repeated stops, into the same whole number of `steps` objects for each run (at least one, so about
`steps` in all), each run starting on an object's edge; a gradient that needs more than 256 runs across the box stays
a gradient:
```json
{"name":"run_command","arguments":{"command":"paint.editGradient","params":{"spread":"reflect","repeats":3}}}