https://github.com/22a/cs4012-lab1
:art: Web service that renders shapes described by a DSL as SVG
https://github.com/22a/cs4012-lab1
Last synced: 11 months ago
JSON representation
:art: Web service that renders shapes described by a DSL as SVG
- Host: GitHub
- URL: https://github.com/22a/cs4012-lab1
- Owner: 22a
- License: bsd-3-clause
- Created: 2016-11-12T14:35:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-21T23:30:04.000Z (over 9 years ago)
- Last Synced: 2025-03-02T00:51:13.904Z (over 1 year ago)
- Language: Haskell
- Homepage:
- Size: 194 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SVGoodness
A web service that lets you describe drawings in a custom shape DSL and have them rendered as SVG in realtime in front of your very eyes.

## Prerequisites
* [Haskell Stack](https://www.haskellstack.org)
## Installation
Clone the repo:
```bash
git clone https://github.com/22a/cs4012-lab1.git && cd cs4012-lab1
```
Setup the project:
```bash
stack setup
```
Build the project:
```bash
stack build
```
Run the server:
```bash
stack exec cs4012-lab1-exe
```
## Usage
Navitage to `localhost:3000` in your browser
## Shape DSL Syntax
A `Drawing` is a list of `Shapes`.
A `Shape` is a triple of a basic shape, the stylesheet for that shape, and a transformation to be applied to that shape.
Transformations are composed with the infix `:>` operator and are applied from left to right.
### Possible Basic Shapes
* Empty
* Square
* Circle
### Stylesheets
Stylesheets are a triple of stroke width, stroke colour, and fill colour. All three are mandatory.
### Possible Transformations
* Ident
* Translate tx ty
* Scale sx sy
* SkewX angle
* SkewY angle
* Rotate angle
The order of transformation matters, these two are not the same:
* `(Scale 2.0 2.0) :> (Translate 10.0 10.0)`
* `(Translate 10.0 10.0) :> (Scale 2.0 2.0)`