NimSvg
NimSvg copied to clipboard
polyline element
Thank you for the amazing library!
Right now you can create a polyline like:
polyline(points="10.0,100.0 20.0,200.0", etc....)
Is there any interest in adding polyline to styles but having the points param being some other type like seq[tuple(float,float)]? Maybe there isn't any advantage though.
Yes something like that makes definitely sense.
In general I always wanted to add a more higher level convenience API with explicitly typed arguments. A draft of that is available in https://github.com/bluenote10/NimSvg/blob/master/src/nimsvg/styles.nim
Note: Style
is a bit of a misnomer, perhaps it should rather be called Styled
or StyledContext
. In any case it allows to write stuff like
let styled = defaultStyle()
styled.circle(0, 0, r=10)
# offers often needed convenience like centering a rect
styled.rectCentered(0, 0, w=10, h=10)
# and it would be easy to add
styled.polyline(points)