@hackage / diagrams-canvas

HTML5 canvas backend for diagrams drawing EDSL

Latest1.4.2

About

Metadata

  • Last updated , by BrentYorgey
  • License BSD-3-Clause
  • Categories Graphics
  • Maintained by: diagrams-discuss@googlegroups.com

  • Lottery factor: 2

Links

Installation

Tested Compilers

  1. 9.12.1
  2. 9.10.1
  3. 9.8.2
  4. 9.6.5
  5. 9.4.8
  6. 9.2.8
  7. 9.0.2
  8. 8.10.7
  9. 8.8.4

Readme

diagrams-canvas

diagrams-canvas is a canvas backend for diagrams based on the blank-canvas https://github.com/ku-fpg/blank-canvas package. Diagrams is a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language. It supports most features defined in diagrams-lib.

Installation

cabal update && cabal install diagrams-canvas

Usage

A simple example that uses diagrams-canvas to draw a square.

import Diagrams.Prelude
import Diagrams.Backend.Canvas.CmdLine

b1 = (square 20 :: Diagram B) # lw 0.002

main = mainWith (pad 1.1 b1)

Save this to file named Square.hs and compile this program:

ghc --make -threaded Square.hs

This will generate an executable which, when run dispays the resulting diagrams to http://localhost:3000/

$ ./Square -w 750