Skip to content
fill_ring_sector

fill_ring_sector

Mojo function 🡭

fill_ring_sector

fn def fill_ring_sector(mut canvas: Canvas, cx: Float64, cy: Float64, inner_radius: Float64, outer_radius: Float64, start_angle: Float64, end_angle: Float64, color: Color)

A solid ring/donut segment: the region between inner_radius and outer_radius within the angle span. Built like fill_arc – sample the outer arc forward and the inner arc backward, so the combined points trace the ring’s boundary as one continuous loop, then fill_polygon.

Args:

  • canvas (Canvas): Canvas to fill into.
  • cx (Float64): Center x.
  • cy (Float64): Center y.
  • inner_radius (Float64): Ring’s inner edge, in pixels.
  • outer_radius (Float64): Ring’s outer edge, in pixels. Must exceed inner_radius.
  • start_angle (Float64): Sweep start, radians, 0 pointing along +x.
  • end_angle (Float64): Sweep end, radians. Must be >= start_angle.
  • color (Color): Fill color.