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

Function dashStart

path.go:1760–1778  ·  view source on GitHub ↗
(offset float64, d []float64)

Source from the content-addressed store, hash-verified

1758}
1759
1760func dashStart(offset float64, d []float64) (int, float64) {
1761 i0 := 0 // index in d
1762 for d[i0] <= offset {
1763 offset -= d[i0]
1764 i0++
1765 if i0 == len(d) {
1766 i0 = 0
1767 }
1768 }
1769 pos0 := -offset // negative if offset is halfway into dash
1770 if offset < 0.0 {
1771 dTotal := 0.0
1772 for _, dd := range d {
1773 dTotal += dd
1774 }
1775 pos0 = -(dTotal + offset) // handle negative offsets
1776 }
1777 return i0, pos0
1778}
1779
1780// dashCanonical returns an optimized dash array.
1781func dashCanonical(offset float64, d []float64) (float64, []float64) {

Callers 2

checkDashMethod · 0.85
DashMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected