mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 13:08:32 +00:00
The canvas flattened a stroke's outline at 0.25 device pixels with chords inside each curve, so a wide curved stroke's outer rim drew too light and its inner rim too dark. A stroke at least 32 drawing tolerances wide now draws each curve of its outline that spans 128 tolerances or more as lines placed by its bend, with each line end moved outward by half the line's bulge, so the lines lie on both sides of the curve. That is 8 and 32 device pixels at 25% and 1:1, and as little as just over 4 and 16 device pixels at other zooms, where the cached outline's tolerance is the largest power of two at or below a quarter device pixel. At 25% zoom an 80 pt ring's worst edge pixel is 24 levels off the exact coverage at the outer rim and 32 at the inner rim, where it was 54 and 61; at 1:1 it is 30 and 29, where it was 64 and 58. Curve ends at corners, lines and short curves stay on the curve. Outlines are cached per zoom level as before, with refined and plain outlines kept apart. Raster exports draw the same refined edges as the canvas. Fills, narrower strokes, strokes with a width profile, strokes in an unevenly scaled view and vector exports are unchanged. Tests: render::tests::curvedstrokeedges and longstroke::a_long_wide_curved_stroke_draws_the_same_pixels_outlined_near_the_view.