(path string, width, height float64)
| 172 | } |
| 173 | |
| 174 | func (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 | |
| 193 | func (p Paths) ToSVG(width, height float64) string { |
| 194 | var lines []string |