Skip to content
hatch_tile

hatch_tile

Mojo function 🡭

hatch_tile

fn def hatch_tile(spacing: Int, width: Float64, color: Color, background: Color, kind: Hatch) -> Canvas

Render a hatch pattern once into a spacing x spacing tile, ready to hand to PatternSource under Extend.REPEAT.

Args:

  • spacing (Int): Tile side length, and the period of the pattern.
  • width (Float64): Line width for DIAGONAL/CROSS/HORIZONTAL/VERTICAL, or dot diameter for DOTS.
  • color (Color): Ink color.
  • background (Color): Fill behind the ink.
  • kind (Hatch): Which pattern to render – see Hatch.

Returns:

Canvas: A new spacing x spacing canvas holding the rendered tile.

Raises: