personal-1.1.0: Personal web site for Yoo Chung
CopyrightCopyright (C) 2023 Yoo Chung
LicenseAll rights reserved
Maintainerweb@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Diagrams.Runner

Description

Exports the putDiagram function for conveniently printing SVG generated from a diagram.

This also re-exports the Diagrams.Prelude and Diagrams.Backend.SVG modules, so that code does not have to import these separately.

Synopsis

Documentation

putDiagram :: SVGFloat n => Options SVG V2 n -> QDiagram SVG V2 n Any -> IO () Source #

Write out SVG for the given diagram to standard output.

>>> putDiagram defaultOptions $ circle 1
<?xml version="1.0" encoding="UTF-8"?>
...

It can be passed in a fully specified SVGOptions, but it is usually enough to give the default set of options in defaultOptions.

defaultOptions :: SVGFloat n => Options SVG V2 n Source #

Default options for rendering a diagram into SVG.

This is a record value, so specific options can be overridden using record syntax. For example, the width of the rendered image can be overridden:

>>> let options = defaultOptions & sizeSpec .~ mkWidth 128
>>> view sizeSpec options
SizeSpec (V2 128.0 0.0)