Personal tools

Diagrams

From HaskellWiki

Revision as of 09:03, 29 October 2009 by Lenny222 (Talk | contribs)

Jump to: navigation, search

The diagrams library provides an embedded domain-specific language (EDSL) for creating simple pictures and diagrams in Haskell


Contents

1 Rewrite

Many Haskell graphic libraries are tied to a specific rendering backend (Cairo, OpenGL, libGD etc) which makes collaboration and reuse of code and data structures very hard or impossible.

Also some dependencies are hard to fulfill. Cairo is very difficult to install on Mac OS 10.6. If you just need to generate PDF diagrams, you could choose the pure HPDF library where e.g. Hieroglyph can not be installed because of its Cairo dependence.

A rewrite of diagrams should include separate packages for:

1.1 Core DSL

  • graphical primitives
    • path (moveTo, lineTo, curveTo, arcTo, etc)
      • boolean operations of paths
    • text, ellipses, rectangles, polygons
      • imho there should be primitive shape typeclass, so that shapes like circles and rectangles have a "convertToPath" function. Backends like SVG can then choose to convert shapes like a rectangle to a polygon or to a SVG rectangle
  • graphical attributes
    • fill
      • solid color, patterns, gradients
    • stroke
      • fill, marker symbols, decorations
    • effects
      • shadow, blur, turbulence
  • constraint solving
  • animations/pages/frames

1.2 Modules/Extensions

1.3 Input/Output

1.3.1 Output

  • interactive drawing via Cairo
  • PDF export via pure HPDF
  • EPS export
  • SWF export
  • LaTeX export
  • exotic backends

1.3.2 Input

  • pure Haskell PNG import via pngload
  • pure Haskell SVG import

2 Inspiration

2.1 Related non-Haskell projects

2.2 Food for thought