MCPcopy
hub / github.com/fogleman/ln / WriteToPNG

Method WriteToPNG

ln/path.go:174–191  ·  view source on GitHub ↗
(path string, width, height float64)

Source from the content-addressed store, hash-verified

172}
173
174func (p Paths) WriteToPNG(path string, width, height float64) {
175 scale := 1.0
176 w, h := int(width*scale), int(height*scale)
177 dc := gg.NewContext(w, h)
178 dc.InvertY()
179 dc.SetRGB(1, 1, 1)
180 dc.Clear()
181 dc.SetRGB(0, 0, 0)
182 dc.SetLineWidth(3)
183 for _, path := range p {
184 for _, v := range path {
185 dc.LineTo(v.X*scale, v.Y*scale)
186 }
187 dc.NewSubPath()
188 }
189 dc.Stroke()
190 dc.SavePNG(path)
191}
192
193func (p Paths) ToSVG(width, height float64) string {
194 var lines []string

Callers 15

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
runFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected