mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 06:31:41 +00:00
A blend pixel took a side of its edge only when the picture's own colors on both sides lay within 2 px of it. With a limited palette, an edge blurred over more than about 4 px kept the middle of its ramp in the palette's in-between tones, which traced as rings of thin paths around the edge. With a Limited palette of at most 16 colors (3 Colors, 6 Colors, 16 Colors) and in Grayscale with at most 16 grays (Shades of Gray), settled_wide looks for the own colors within 8 px, pairs the 8 of them nearest to the pixel's color, and moves the pixel to the nearer side of the best pair when that pair explains it twice as well as its own color, or when it lies between the two and off the line between them by less than 0.15 of their distance apart. These values are VectorCraft's own. Of two pairs that explain it equally well it takes the closer one. A pixel keeps its color when an own pixel of that color lies within 4 px or when its color is one of the pair. Grayscale compares lightness. The colors within reach are kept as bitsets for a strip of 7 columns at a time. High Fidelity Photo, Low Fidelity Photo, Black and White and the other palettes keep the 2 px rule unchanged. On the quality harness, blurred and scanned flat art with 6 and 16 Colors goes from 6 to 9 paths to 3, and from 0.23 to 0.26 px off to 0.07 to 0.11. Askew shapes take up to 11 px more area in colors the art does not have, thin lines with 16 Colors lose more (largest distance 23.5 to 45.3 px), and Shades of Gray traces thin lines in 7.3 paths where it took 5.3. Noisy images settle more of their pixels: the dense grouping test traces 150 x 150 noise instead of 120 x 120 to keep more than its 500 paths. Covers the limited-palette part of #1911 (leogrox). Docs: docs/target-app-parity.md, docs/image-trace-quality.md.