diagrams-rasterific-0.1.0.7: Rasterific backend for diagrams.

Copyright(c) 2014 diagrams-rasterific team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Backend.Rasterific

Description

A full-featured rendering backend for diagrams using Rasterific, implemented natively in Haskell (making it easy to use on any platform). Can create png, tif, bmp, jpg, and animated GIFs.

To invoke the Rasterific backend, you have three options.

  • You can use the Diagrams.Backend.Rasterific.CmdLine module to create standalone executables which output images when invoked.
  • You can use the renderRasterific function provided by this module, which gives you more flexible programmatic control over when and how images are output (making it easy to, for example, write a single program that outputs multiple images, or one that outputs images dynamically based on user input, and so on).
  • For the most flexibility (e.g. if you want access to the resulting Rasterific value directly in memory without writing it to disk), you can manually invoke the renderDia method from the Backend instance for Rasterific. In particular, renderDia has the generic type
renderDia :: b -> Options b v -> QDiagram b v m -> Result b v

(omitting a few type class constraints). b represents the backend type, v the vector space, and m the type of monoidal query annotations on the diagram. Options and Result are associated data and type families, respectively, which yield the type of option records and rendering results specific to any particular backend. For b ~ Rasterific and v ~ R2, we have

data Options Rasterific R2 = RasterificOptions
         { _rasterificSizeSpec      :: SizeSpec2D -- ^ The requested size of the output
         , _rasterificBypassAdjust  :: Bool       -- ^ Should the 'adjustDia' step be bypassed during rendering?
         }
data family Render Rasterific R2 = 'R (RenderM ())'
type family Result Rasterific R2 = 'Image PixelRGBA8'

So the type of renderDia resolves to

renderDia :: Rasterific -> Options Rasterific R2 -> QDiagram Rasterific R2 m -> 'Image PixelRGBA8'

which you could call like renderDia Rasterific (RasterificOptions (Width 250)) myDiagram.

Synopsis

Documentation

data Rasterific Source

This data declaration is simply used as a token to distinguish the Rasterific backend: (1) when calling functions where the type inference engine would otherwise have no way to know which backend you wanted to use, and (2) as an argument to the Backend and Renderable type classes.

Constructors

Rasterific 

data family Options b v

Backend-specific rendering options.