FillPolygon fills a polygon with the given color.
(clr color.Color, pts []vg.Point)
| 530 | |
| 531 | // FillPolygon fills a polygon with the given color. |
| 532 | func (c *Canvas) FillPolygon(clr color.Color, pts []vg.Point) { |
| 533 | if len(pts) == 0 { |
| 534 | return |
| 535 | } |
| 536 | |
| 537 | c.SetColor(clr) |
| 538 | p := make(vg.Path, 0, len(pts)+1) |
| 539 | p.Move(pts[0]) |
| 540 | for _, pt := range pts[1:] { |
| 541 | p.Line(pt) |
| 542 | } |
| 543 | p.Close() |
| 544 | c.Fill(p) |
| 545 | } |
| 546 | |
| 547 | // ClipPolygonXY returns a slice of lines that |
| 548 | // represent the given polygon clipped in both |