Build plano-convex bar shapes as single coherent paths (fix internal seam when stroked)#153
Open
postfixNotation wants to merge 2 commits into
Open
Build plano-convex bar shapes as single coherent paths (fix internal seam when stroked)#153postfixNotation wants to merge 2 commits into
postfixNotation wants to merge 2 commits into
Conversation
The plano-convex bar shapes assembled their outline from separate subpaths (raw addRect + addArc, and two addPath unions in the parameterized variants). Filling renders this correctly, but stroking the outline via DefaultBar's border draws the rectangle's interior edge as a stray line across the bar at the body/cap junction. - Merge body and cap into one contour via union (+) in DefaultVerticalPlanoConvexShape, DefaultHorizontalPlanoConvexShape and the index != 0 branches of VerticalPlanoConvexShape / HorizontalPlanoConvexShape, removing the internal seam when stroked - Leave the bi-convex shapes unchanged: their closing difference (-) already normalizes the boundary into a clean single contour - index == 0 branches: return the (optionally inverted) path explicitly instead of mutating the wrapped outline in place - Fill area and geometry are unchanged; the fix only affects the stroke/border case
63642cb to
33f2790
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds the plano-convex bar shapes as a single continuous
Pathinstead of several independent subpaths. Filling already rendered correctly, but stroking the outline (viaDefaultBar'sborder) drew the rectangle's interior edge as a stray line across each bar at the body/cap junction. Merging body and cap into one contour removes that internal seam.Background / root cause
DefaultVerticalPlanoConvexShape,DefaultHorizontalPlanoConvexShapeand theindex != 0branches ofVerticalPlanoConvexShape/HorizontalPlanoConvexShapeassembled their outline from separate subpaths (addRect+addArc, or twoaddPathunions).A single
Pathcontaining abutting subpaths fills as the correct union in one pass, so the fill output was fine. ButModifier.border(border, shape)strokes every contour of the outline, including the rectangle's top/side edge that sits interior to the shape. The result is a visible line where the body meets the convex cap — clearly seen on stacked bars, where it appears at the junction of every segment.Changes
+) inDefaultVerticalPlanoConvexShape,DefaultHorizontalPlanoConvexShape, and theindex != 0branches ofVerticalPlanoConvexShape/HorizontalPlanoConvexShape. The union removes the internal edge while leaving the filled area unchanged.-) already normalizes the boundary into a clean single contour.index == 0branches: return the (optionally inverted) path explicitly instead of mutating the wrapped outline in place — a small readability cleanup adjacent to the same code.Result
Screenshots
Stacked bars rendered with a border (the case that exposed the seam):
In Before, a horizontal line cuts across each segment where the body meets the cap. In After, only the outer outline is stroked.
Testing
Visual checks via Compose
@Previewfor vertical and horizontal plano-convex bars, single and stacked, both filled and with a border. Confirmed the fill output is unchanged and the internal seam is gone under stroking.Notes for reviewers
+(union) and-(difference) operators wrapPath.op(..., PathOperation.…).index != 0performs two differences + one union percreateOutline, vs. two differences + twoaddPathpreviously);createOutlineis not called per frame.