Skip to content
fill_mask

fill_mask

Mojo function 🡭

fill_mask

fn def fill_mask(mut canvas: Canvas, mask: Mask, color: Color, x: Int = Int(0), y: Int = Int(0))

Paint color through mask, its top-left corner at (x, y): each pixel the mask covers is written with the color’s alpha scaled by the coverage there. Goes through set_pixel, so the active clip and blend mode apply, and the part of the mask off the canvas is skipped.

Args:

  • canvas (Canvas): Canvas painted into.
  • mask (Mask): Coverage to paint through.
  • color (Color): Color painted. Its own alpha compounds with the coverage.
  • x (Int): Canvas column of the mask’s left edge.
  • y (Int): Canvas row of the mask’s top edge.