Skip to content
fill_path

fill_path

Mojo function 🡭

fill_path

fn def fill_path(mut canvas: Canvas, path: Path, color: Color, fill_rule: FillRule = FillRule.EVEN_ODD, curve_steps: Int = Int(0))

Fill a path’s interior with the scanline algorithm, combining every sub-path’s crossings per scanline into a signed winding number (via polygon_fill’s _spans_from_crossings, shared with fill_polygon). With fill_rule at its EVEN_ODD default, overlapping sub-paths leave a hole where they overlap; with FillRule.NONZERO, two sub-paths wound the same direction fill as one solid union.

Same half-open Y-extent convention as fill_polygon ([min(y0,y1), max(y0,y1))), which makes a vertex shared by two opposite-direction edges count once rather than twice, while a local extremum contributes zero net crossings rather than two.

Args:

  • canvas (Canvas): Canvas to fill into.
  • path (Path): Path to fill.
  • color (Color): Fill color.
  • fill_rule (FillRule): EVEN_ODD (default) or NONZERO – see FillRule.
  • curve_steps (Int): Straight-line segments per quad/cubic Bezier; 0 (the default) chooses per segment.