Skip to content
/ svgerry Public

🖼 CS4012 Project 1: A Haskell SVG Object server using Scotty, Blaze and one more thing...

License

Notifications You must be signed in to change notification settings

shawa/svgerry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Svgerry

A Haskell-powered shape description language and renderer.

Usage

stack build && stack exec svgerry-exe will launch Svgerry on localhost:3000

Shapes Language

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.

Colours

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.

Transforms

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.

About

🖼 CS4012 Project 1: A Haskell SVG Object server using Scotty, Blaze and one more thing...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published