I've been playing with SVG watch dials recently, and needed a tool to simplify trying out ideas. I wrote this as a quick tool to programmatically generate dials. It's by no means a complete svg generator
I described the structure of one of the dials in my blog.
- The opening svg tag uses a viewbox; this makes sure that numbers without unit are considered to be in the unit that can optionally be speficied in
SvgGen::start()
- you can specify masks and clip path using
SvgGen::rect()
- passing arguments allows to select the dial generated
- Since I was getting lazy escaping double quotes in attributes, I'm replacing single quotes to double quotes. Note: there's no way to avoid it
- For the number four, I'm using "IIII" instead of the roman numeral "IV"; this is common for watches, see here
SvgGen
is implemented as a header only class, as it is fairly small; it could be split up to reduce compilation time if this becomes a problem