Skip to content
fill_path_gradient

fill_path_gradient

Mojo function 🡭

fill_path_gradient

fn def fill_path_gradient(mut canvas: Canvas, path: Path, gradient: LinearGradient, fill_rule: FillRule = FillRule.EVEN_ODD, curve_steps: Int = Int(0))

Fill a path’s interior as fill_path does, but sourcing each pixel’s color from gradient (gradient.mojo) rather than one flat Color.

Hard-edged; fill_path_gradient_aa is the anti-aliased counterpart.

Args:

  • canvas (Canvas): Canvas to fill into.
  • path (Path): Path to fill.
  • gradient (LinearGradient): Fill source, queried per pixel.
  • 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.