Skip to content
fill_mask_source

fill_mask_source

Mojo function 🡭

fill_mask_source

fn def fill_mask_source[S: ColorSource](mut canvas: Canvas, mask: Mask, source: S, x: Int = Int(0), y: Int = Int(0))

fill_mask taking each pixel’s color from source – a gradient or a pattern – instead of one flat color. The source is queried in canvas pixel coordinates, as the gradient fills do.

Parameters:

  • S (ColorSource)

Args:

  • canvas (Canvas): Canvas painted into.
  • mask (Mask): Coverage to paint through.
  • source (S): Fill source, asked for its color at every covered pixel.
  • x (Int): Canvas column of the mask’s left edge.
  • y (Int): Canvas row of the mask’s top edge.