Core guide

Filled curved paths

Fill curved subpaths with transparent holes using the even-odd rule.

Live example

See Filled curved paths in action

Render a curved outer region and a transparent inner hole as one command.

live rendering loading ticks 0

How it works

Flatten closed path subpaths, then submit them through the filled_path command. Alternating containment depth creates solid regions, holes, and nested islands without exposing the tessellator or GPU buffers.

Public types

  • FlattenedSubpath
  • FillRule
  • RenderCommand
  • filled_path

Minimum viable example

typescript
const outer = flatten_path([move_to(0, 0), line_to(200, 0), line_to(200, 120), line_to(0, 120), close()], 0.5)[0];
const hole = flatten_path([move_to(40, 30), line_to(40, 90), line_to(160, 90), line_to(160, 30), close()], 0.5)[0];
frame.draw_commands([{ kind: "filled_path", draw: { subpaths: [outer, hole], fill_rule: "even_odd", color: rgba(1, 0, 0, 1) } }]);

Scope and limitations

Only closed subpaths and even_odd are supported. Nonzero winding, automatic closure, and arbitrary tessellation plugins remain deferred.