The diagrams-svg package

[Tags:bsd3, library]

This package provides a modular backend for rendering diagrams created with the diagrams EDSL to SVG files. It uses blaze-svg to be a fast, native Haskell backend, making it suitable for use on any platform.

The package provides the following modules:

Additional documentation can be found in the README file distributed with the source tarball or viewable on GitHub: https://github.com/diagrams/diagrams-svg/blob/master/README.md.


[Skip to Readme]

Properties

Versions 0.3, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.7, 0.6, 0.6.0.1, 0.7, 0.8, 0.8.0.1, 0.8.0.2, 1.0, 1.0.1, 1.0.1.1, 1.0.1.2, 1.0.1.3, 1.0.2, 1.0.2.1, 1.1, 1.1.0.1, 1.1.0.2, 1.1.0.3, 1.1.0.4, 1.1.0.5, 1.3, 1.3.1, 1.3.1.1, 1.3.1.2, 1.3.1.3, 1.3.1.4, 1.3.1.5, 1.3.1.6, 1.3.1.7, 1.3.1.8, 1.3.1.9, 1.3.1.10, 1.4, 1.4.0.1, 1.4.0.2 (info)
Change log CHANGES.markdown
Dependencies base (>=4.3 && <4.8), blaze-svg (>=0.3.3), bytestring (>=0.9 && <1.0), cmdargs (>=0.6 && <0.11), colour, diagrams-core (==0.7.*), diagrams-lib (==0.7.*), directory, filepath, monoid-extras (==0.3.*), mtl (>=1 && <2.2), old-time, process, split (>=0.1.2 && <0.3), time, unix (>=2.4 && <2.8), vector-space (>=0.7 && <0.9) [details]
License BSD3
Author Felipe Lessa, Deepak Jois
Maintainer diagrams-discuss@googlegroups.com
Stability Experimental
Category Graphics
Home page http://projects.haskell.org/diagrams/
Bug tracker http://github.com/diagrams/diagrams-svg/issues
Source repository head: git clone http://github.com/diagrams/diagrams-svg
Uploaded Fri Aug 9 15:24:03 UTC 2013 by BrentYorgey
Distributions Debian:1.3.1.10, LTSHaskell:1.3.1.10, NixOS:1.4.0.2
Downloads 13797 total (153 in the last 30 days)
Votes
0 []
Status Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for diagrams-svg

Readme for diagrams-svg-0.7

Build Status

diagrams-svg is a an SVG backend for diagrams. Diagrams is a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language.

diagrams-svg is a work in progress, and some features are not implemented yet. However, it is functional enough that hs-logo uses it. Check out the issues page to get an idea of the features that are missing.

Installation

cabal update && cabal install diagrams-svg

Usage

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

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

b1 = square 20 # lw 0.002

main = defaultMain (pad 1.1 b1)

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

ghc --make Square.hs

This will generate an executable which, when run produces an SVG file. Run the executable with the --help option to find out more about how to call it.

$ ./Square --help
Command-line diagram generation.

Square [OPTIONS]

Common flags:
  -w --width=INT    Desired width of the output image
  -h --height=INT   Desired height of the output image
  -o --output=FILE  Output file
  -? --help         Display help message
  -V --version      Print version information

You must pass an output file name with a .svg extension to generate the SVG file.

$ ./Square -o square.svg

The command above generates the SVG file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="22.0" height="22.0" viewBox="0 0 22 22">
  <g>
    <g stroke="rgb(0,0,0)" stroke-opacity="1.0" fill="rgb(0,0,0)" fill-opacity="0.0" stroke-width="2.0e-3">
       <path d="M 21.0,21.0 l -2.220446049250313e-15,-20.0 h -20.0 l -2.220446049250313e-15,20.0 Z" />
    </g>
  </g>
</svg>

Other Backends for Diagrams