Commit Graph
5 Commits
Author SHA1 Message Date
dotCooCoo a9aa1f405b Render: curve lines keep both turns of a curve that turns back twice
A curve drawn as lines took its line ends from the curve's bending alone.
Where a curve runs out and back twice along almost one line, its two turns
hold almost no bending, so a thin stroke drew it with one step in two
halves: each half held a whole turn, the two halves' gaps canceled, and
the band ran straight from start to end without either turn. A cubic from
(0, 0) out to x = 28.87 and back to x = -28.87 drew only around x = 0.

Each step is now checked against its curve: where the curve lies more
than twice the chord allowance from the step's line, to either side or
past its ends, the step count doubles, up to the curve's equal steps.
Wide strokes draw their long curves the same way and get the same check.
2026-11-28 14:36:09 -08:00
dotCooCoo d91b815690 Render: thin curve lines stop where the curve turns back
Each line end of a curve drawn as lines moved out by the curve's whole gap
from the chords beside it, including the part along the chord. Where a
curve runs out and back along almost one line, that part points along the
curve, so the end moved past the turn: a cubic from (0, 0) out to x = 75
and back drew its band out to x = 112.5. The ends now move only across
their chords.
2026-11-28 13:49:09 -08:00
dotCooCoo 36c5f65b24 Fix #7257: thin curved strokes draw with half as many outline lines
Strokes narrower than four raster tolerances had their outline fitted and
flattened at a tolerance as fine as 1/16 of the raster tolerance, so each
side of a thin curve took about four times the lines a wider stroke takes,
and every frame drew them all. A plain thin stroke (no dashes, no width
profile) along a path with curves is now drawn as lines first, within a
sixth of its width of the curve, and each side of each line is offset by
exactly half the width. The band keeps its width, the outline takes one
line per side for each line of the path. Where two lines meet at a small
angle both sides go to where their offsets cross; sharper corners get the
stroke's join, open ends its caps, and a closed path keeps its hole. Dashed
and profiled thin strokes, and thin strokes along straight paths, are
unchanged.

On 200 cubic curves about 100 device pixels across, a 0.5 px stroke's
outline goes from 15,559 lines to 7,514 (4,288 before #3273).
2026-11-28 11:28:42 -08:00
dotCooCoo 83d8bcb5ed Render: wide curved strokes draw their rims closer to the curves
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.
2026-11-16 00:24:52 -08:00
FractalEncrypt e0ad7ccf16 Preserve raster coverage of thin curved strokes
Squashed from #3273 onto main.
2026-11-05 20:00:21 +07:00