GraphiteEditor / GraphiteEditor/Graphite

Stroke alignment on «Solidify Stroke»

Aperta
#4,494 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
27.2k
Fork
1.3k
Merge medio
20h 5m
PR unite (30g)
57

Descrizione

The «Solidify Stroke» assumes that all strokes are `StrokeAlign::Center` [sic] causing it to give the incorrect results for `StrokeAlign::Inside` and `StrokeAlign::Outside`.

The alignment can be set in the properties of the stroke node:
the properties panel showing the inside stroke alignment option

A proper implementation of the algorithm must deal with intersecting bézier paths in the same way as the SVG and vello renderer. An interesting case can be seen here where we have a closed path made of just two intersecting cubic béziers:
A figure of 8 path made by crossing two cubic bézier

If the path is not fully closed, then the centre alignment must be used to match the renderer. Also note that a path can contain multiple contours. These can likely be dealt with individually?

To deal with intersections of paths in an efficient the [`linesweeper` crate](https://docs.rs/linesweeper) can be used since it is already included as a dependency.

The `kurbo::stroke` function only supports centre alignment. I'm not sure if it is within scope to add other alignments to it.

As reported by [@Menxs on discord](https://discord.com/channels/731730685944922173/1134981447539761273/1544038003955990538).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by locating the Solidify Stroke implementation and its StrokeAlign handling. Compare its behavior for open, closed, intersecting, and multi-contour paths with the SVG and vello renderer, and review the available linesweeper dependency alongside kurbo::stroke. Done means Inside, Outside, and Center alignments produce matching results, with open paths retaining center alignment.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
computer-graphics
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.