mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 21:17:48 +00:00
Where a band border in a gradient or a shaded area runs at a slant, its pixels form a staircase whose steps are two or more pixels long. When one piece of outline also runs along a sharp edge in the image, that piece as a whole is not the contour of a smooth area, and the outline kept a corner at every step, so the border was traced as a series of right-angle steps. subpixel::outline now reads a run of three or more edges of 1 to 8 px, each turning one way where it starts and the other where it ends, with no junction on it, as a staircase when the run's own cracks pass subpixel::low_contrast. A run is cut at any step whose own cracks show half of the step between the two colors or more. Its edges are steps, as one-pixel steps already were: no corner where two of them meet, and one point at the middle of each, moved by the mean of its cracks' shifts. The corner where a run meets an edge that is not a step stays, so a straight edge longer than 8 px next to a staircase stays straight. Two one-pixel steps inside a run are read as part of the slope and do not make a notch. Longer steps, staircases along a sharp edge and Black and White traces keep their corners. The runs are the same from either side of the border. On gradient and photo inputs most traces take fewer anchors. Some rows get worse: 6 Colors on gradient and photo leaves a gap of 0.9 px (was 1.2) and an overlap of 1.0 px (was 0.8), High Fidelity Photo with Gradients on a blurred input takes 50 anchors (was 47), and on a synthetic 800 px photo the 95th percentile of High Fidelity Photo's pixel difference rises from 6.33 to 6.67 and 16 Colors leaves 2 staircases of 2 px steps or more where it left none. Docs: docs/target-app-parity.md, docs/image-trace-quality.md.