MCPcopy
hub / github.com/tdewolff/canvas / Path

Method Path

path_scanner.go:83–98  ·  view source on GitHub ↗

Path returns the current path segment.

()

Source from the content-addressed store, hash-verified

81
82// Path returns the current path segment.
83func (s *PathScanner) Path() *Path {
84 p := &Path{}
85 p.MoveTo(s.Start().X, s.Start().Y)
86 switch s.Cmd() {
87 case LineToCmd:
88 p.LineTo(s.End().X, s.End().Y)
89 case QuadToCmd:
90 p.QuadTo(s.CP1().X, s.CP1().Y, s.End().X, s.End().Y)
91 case CubeToCmd:
92 p.CubeTo(s.CP1().X, s.CP1().Y, s.CP2().X, s.CP2().Y, s.End().X, s.End().Y)
93 case ArcToCmd:
94 rx, ry, rot, large, sweep := s.Arc()
95 p.ArcTo(rx, ry, rot, large, sweep, s.End().X, s.End().Y)
96 }
97 return p
98}
99
100// PathReverseScanner scans the path in reverse order.
101type PathReverseScanner struct {

Callers

nothing calls this directly

Calls 11

MoveToMethod · 0.95
StartMethod · 0.95
CmdMethod · 0.95
LineToMethod · 0.95
EndMethod · 0.95
QuadToMethod · 0.95
CP1Method · 0.95
CubeToMethod · 0.95
CP2Method · 0.95
ArcMethod · 0.95
ArcToMethod · 0.95

Tested by

no test coverage detected