Skip to content
fill_rect_pattern

fill_rect_pattern

Mojo function 🡭

fill_rect_pattern

fn def fill_rect_pattern(mut canvas: Canvas, x: Int, y: Int, width: Int, height: Int, pattern: PatternSource)

Like fill_rect_gradient, but for a PatternSource (pattern.mojo): each pixel’s color comes from a sampled raster tile rather than a gradient projection. Same once-up-front clamp as fill_rect.

Args:

  • canvas (Canvas): Canvas to fill into.
  • x (Int): Rectangle’s left edge.
  • y (Int): Rectangle’s top edge.
  • width (Int): Rectangle’s width.
  • height (Int): Rectangle’s height.
  • pattern (PatternSource): Fill source, sampled across the rectangle.