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

Method StartPos

path.go:374–383  ·  view source on GitHub ↗

StartPos returns the start point of the current subpath, i.e. it returns the position of the last MoveTo command.

()

Source from the content-addressed store, hash-verified

372
373// StartPos returns the start point of the current subpath, i.e. it returns the position of the last MoveTo command.
374func (p *Path) StartPos() Point {
375 for i := len(p.d); 0 < i; {
376 cmd := p.d[i-1]
377 if cmd == MoveToCmd {
378 return Point{p.d[i-3], p.d[i-2]}
379 }
380 i -= cmdLen(cmd)
381 }
382 return Point{}
383}
384
385// Coords returns all the coordinates of the segment start/end points. It omits zero-length CloseCmds.
386func (p *Path) Coords() []Point {

Callers 3

JoinMethod · 0.95
CloseMethod · 0.95
ParseSVGPathFunction · 0.95

Calls 1

cmdLenFunction · 0.85

Tested by

no test coverage detected