A Haskell-powered shape description language and renderer.
stack build && stack exec svgerry-exe
will launch Svgerry on localhost:3000
Shape documents are specified as a list of triples, where each triple is a style sheet, a list of transforms to apply (in left to right order) and a base shape (either a Square
or a Circle
)
For example,
[ ([FillColour Steelblue], [Rotate 45], Square) ]
Will draw a blue unit square on its side.
The colour arguments for FillColour
, StrokeColour
can be specified as either a Web Colour literal, (Hex "xxxxxx")
or (RGBA r g b a)
, where each of r
, g
, b
are integers, and a
is a real.
The possible transforms are Rotate <angle>
, Scale <y> <x>
and Translate <y> <x>
. Transforms are applied one after another, so their order is significant.
For example, a 45 degree rotation followed by a translation by 5 units, will translate the shape along the rotated coordinate space. Adding a scale in the middle would scale the coordinate space as well; the translation's effect is magnified by that scale.
This can be used to introduce Skews for free, give it a go!
To minimize surprise, specify transforms in the order Translate
, then Rotate
, then Scale
.