QuadTo adds a quadratic Bézier path with control point (cpx,cpy) and end point (x,y).
(cpx, cpy, x, y float64)
| 451 | |
| 452 | // QuadTo adds a quadratic Bézier path with control point (cpx,cpy) and end point (x,y). |
| 453 | func (p *Path) QuadTo(cpx, cpy, x, y float64) { |
| 454 | start := p.Pos() |
| 455 | cp := Point{cpx, cpy} |
| 456 | end := Point{x, y} |
| 457 | if start.Equals(end) && start.Equals(cp) { |
| 458 | return |
| 459 | } else if !start.Equals(end) && (start.Equals(cp) || angleEqual(end.Sub(start).AngleBetween(cp.Sub(start)), 0.0)) && (end.Equals(cp) || angleEqual(end.Sub(start).AngleBetween(end.Sub(cp)), 0.0)) { |
| 460 | p.LineTo(end.X, end.Y) |
| 461 | return |
| 462 | } |
| 463 | |
| 464 | if len(p.d) == 0 { |
| 465 | p.MoveTo(0.0, 0.0) |
| 466 | } else if p.d[len(p.d)-1] == CloseCmd { |
| 467 | p.MoveTo(p.d[len(p.d)-3], p.d[len(p.d)-2]) |
| 468 | } |
| 469 | p.d = append(p.d, QuadToCmd, cp.X, cp.Y, end.X, end.Y, QuadToCmd) |
| 470 | } |
| 471 | |
| 472 | // CubeTo adds a cubic Bézier path with control points (cpx1,cpy1) and (cpx2,cpy2) and end point (x,y). |
| 473 | func (p *Path) CubeTo(cpx1, cpy1, cpx2, cpy2, x, y float64) { |
no test coverage detected