Skip to content

drawrect2d: support elliptical corners#44

Open
mbouron wants to merge 6 commits into
mainfrom
drawrect2d-ellipse
Open

drawrect2d: support elliptical corners#44
mbouron wants to merge 6 commits into
mainfrom
drawrect2d-ellipse

Conversation

@mbouron

@mbouron mbouron commented May 26, 2026

Copy link
Copy Markdown
Owner

No description provided.

@mbouron mbouron force-pushed the drawrect2d-ellipse branch 2 times, most recently from 061c6e3 to 37ea1f5 Compare May 28, 2026 06:31
@mbouron mbouron force-pushed the drawrect2d-ellipse branch from 37ea1f5 to 18178d5 Compare June 14, 2026 19:34
@mbouron mbouron force-pushed the drawrect2d-ellipse branch 6 times, most recently from a465225 to 805a47b Compare June 15, 2026 11:06
Rework the dashed-stroke shader so the pattern is uniform, seam-free and
properly capped around the whole perimeter, including corners.

- Drive every cap style from a single arc-length perimeter coordinate,
  dropping the butt cap's AABB nearest-edge heuristic whose iso-t lines
  kinked along the corner diagonal and sliced any dash landing there.

- Snap the dash period so a whole number of periods fit the perimeter.
  The requested length rarely divides it evenly, which left a partial
  dash at the wrap point that slid around (and popped in and out)
  whenever the length changed; the snapped pattern closes on itself.

- Compute round caps in true 2D. A dash is the stroke of a centerline
  segment: the body is the perpendicular stroke distance, the ends are
  disks around the segment endpoints recovered from their arc length
  (ngli_perim_point). This keeps caps circular where the perimeter
  curves, instead of the distortion of an unrolled (arc-length,
  perpendicular) capsule.

- Run the round-cap path along the stroke centerline (boundary offset by
  the stroke position) so a convex corner rounds by that offset: an
  outside stroke now turns a sharp corner with a smooth join rather than
  a square block. Butt/square caps keep the boundary inflated to half
  the stroke width, enough corner arc for a seam-free t.

- Skip the round-cap endpoint evaluation for fragments farther than the
  stroke half-width from the centerline (the bulk of the quad), where no
  cap can reach and the dash contribution is zero anyway, and only take
  the arc-length-derivative AA width in the butt/square branches that use
  it. Both are pixel-exact (refs unchanged).

dash_length is now documented as a target that is snapped to tile evenly,
and the dashed-stroke refs are regenerated to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant