wumpus-core-0.16.0: Pure Haskell PostScript and SVG generation.

PortabilityGHC with TypeFamilies and more




Output SVG.

This is complicated by two differences with PostScript.

  1. The coordinate space of SVG is origin top-left, for PostScript it is origin bottom-left.
  2. Clipping in PostScript works by changing the graphics state Clip a path, then all subsequent drawing be rendered only when it is within the clip bounds. Clearly using clipping paths within a gsave ... grestore block is a good idea...

SVG uses tagging. A clipPath element is declared and named then referenced in subsequent elements via the clip-path attribute - clip-path="url(#clip_path_tag)".


Output SVG

writeSVG :: (Ord u, PSUnit u) => FilePath -> TextEncoder -> Picture u -> IO ()Source

Output a picture to a SVG file.

writeSVG_latin1 :: (Ord u, PSUnit u) => FilePath -> Picture u -> IO ()Source

Version of writeSVG - using Latin1 encoding.