@hackage diagrams-postscript1.5.3
Postscript backend for diagrams drawing EDSL
Installation
Tested Compilers
Dependencies (13)
- base >=4.8 && <4.22
- bytestring >=0.9 && <0.13
- containers >=0.3 && <0.9
- data-default >=0.8 && <0.9
- diagrams-core >=1.3 && <1.6
- diagrams-lib >=1.4.5 && <1.6 Show all…
Dependents (8)
@hackage/midi-music-box, @hackage/PrimitiveArray-Pretty, @hackage/diagrams, @hackage/acme-everything, @hackage/diagrams-builder, @hackage/Chart-tests, Show all…
diagrams-postscript is a rendering backend for diagrams, a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language.
diagrams-postscript has a simple rendering engine that outputs PostScript™ language files and is an officially supported backend for diagrams.
Installation
cabal update && cabal install diagrams-postscript
Basic usage
A simple example that uses diagrams-postscript to draw a blue circle:
import Diagrams.Prelude
import Diagrams.Backend.Postscript.CmdLine
d = circle 1 # fc blue
main = mainWith (pad 1.1 d)
Save this to file named Circle.hs and compile it:
ghc --make Circle.hs
This will generate an executable which, when run, outputs a blue
circle to some file. Run the executable with the --help option to
find out more about how to call it.
$ ./Circle --help
./Circle
Usage: ./Circle [-w|--width WIDTH] [-h|--height HEIGHT] [-o|--output OUTPUT]
Command-line diagram generation.
Available options:
-?,--help Show this help text
-w,--width WIDTH Desired WIDTH of the output image
-h,--height HEIGHT Desired HEIGHT of the output image
-o,--output OUTPUT OUTPUT file
The output type will be automatically determined from the file extension. Currently EPS and PS are supported.
$ ./Circle -o circle.eps -w 400
The command above generates an EPS file with a width of 400pt.
Advanced usage
Instead of just creating a standalone executable, the postscript backend can also be called from within a larger program. For more information, see the Diagram.Backend.Postscript module.
--
PostScript™ is a trademark of Adobe.
