Skip to content

A Haskell Stack program to extend a DSL to describe shapes and represent them as an SVG

License

Notifications You must be signed in to change notification settings

mcnestrb/ShapeServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

our# ShapeServer DSL

Running the Code

From the stack app root use:

stack ghci
main

If any changes are made to the file then within stack ghci just use :r to reload the files before running main again.

Drawing Description Format

A Drawing is a list of the triple (Transform, Shape, Style)

Transform

  • Identity: Does nothing to transform the shape
  • Translate (Vector Double Double): Translates the object according to the vector in the x and y direction
  • Scale (Vector Double Double: Scales the object according to the vector in the x and y direction
  • Rotate Double: Rotates the object about the origin
  • Compose Transform Transform: Allows the user to use multiple Transforms

Shape

The input box takes in shapes that are either a Circle or a Square.

Style

The input box takes in shapes that are either a Circle or a Square.

Style

Style is in the form of Style Colour Colour Double. Colours can be either Red, Blue, Green, Black or White The first Colour is the strokeColour The second Colour is the fillColour The Double is the strokeWidth

Sample Input

The sample input already in the text box produces the following shape [((Compose (Translate (Vector 100.0 0.0)) (Scale (Vector 1.1 1.1))), Circle, (Style Black Blue 2.0)), (Identity, Square, (Style Red Green 5.0))]

Shape Example

About

A Haskell Stack program to extend a DSL to describe shapes and represent them as an SVG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published