tinyrelayfile
tinyrelay/internal/seedmark/primitives.go/

internal/seedmark/primitives.go raw
1package seedmark
2
3import "strconv"
4
5func num(value float64) string { return strconv.FormatFloat(value, 'f', -1, 64) }
6
7func circle(x, y, radius float64, fill string) string {
8 return `<circle cx="` + num(x) + `" cy="` + num(y) + `" r="` + num(radius) + `" fill="` + fill + `"/>`
9}
10
11func ellipse(x, y, rx, ry float64, fill string) string {
12 return `<ellipse cx="` + num(x) + `" cy="` + num(y) + `" rx="` + num(rx) + `" ry="` + num(ry) + `" fill="` + fill + `"/>`
13}
14
15func rect(x, y, width, height, rx float64, fill string) string {
16 return `<rect x="` + num(x) + `" y="` + num(y) + `" width="` + num(width) + `" height="` + num(height) + `" rx="` + num(rx) + `" fill="` + fill + `"/>`
17}
18
19func path(d, fill string) string { return strokePath(d, fill, "none", 0) }
20
21func strokePath(d, fill, stroke string, width float64) string {
22 return `<path d="` + d + `" fill="` + fill + `" stroke="` + stroke + `" stroke-width="` + num(width) + `" stroke-linecap="round" stroke-linejoin="round"/>`
23}
24
25func group(body, transform string) string {
26 return `<g transform="` + transform + `">` + body + `</g>`
27}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs