draw_polygon
Mojo function 🡭
draw_polygon
fn def draw_polygon(mut canvas: Canvas, points: List[Point], color: Color, dashes: List[Float64] = List(), dash_offset: Float64 = 0)Like draw_polyline, but closes the shape by connecting the last point back to the first.
The closing segment skips both its shared start point (drawn by the previous segment) and its shared end point (drawn as the polygon’s first pixel), so every vertex is drawn exactly once. Dash phase carries all the way around, closing segment included.
Args:
- canvas (
Canvas): Canvas to draw into. - points (
List[Point]): Vertices to connect, in order. - color (
Color): Line color. - dashes (
List[Float64]): On/off segment lengths in pixels, cycled all the way around the polygon. Empty (default) draws a solid line. - dash_offset (
Float64): Distance into the dash pattern the polygon starts at.