{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Diagrams.Runner
( putDiagram,
defaultOptions,
module Diagrams.Prelude,
module Diagrams.Backend.SVG,
)
where
import Data.Text.Lazy.IO (putStr)
import Diagrams.Backend.SVG
import Diagrams.Prelude
import Graphics.Svg
import Prelude hiding (putStr)
putDiagram :: (SVGFloat n) => Options SVG V2 n -> QDiagram SVG V2 n Any -> IO ()
putDiagram :: forall n.
SVGFloat n =>
Options SVG V2 n -> QDiagram SVG V2 n Any -> IO ()
putDiagram Options SVG V2 n
options QDiagram SVG V2 n Any
diagram =
Text -> IO ()
putStr (Text -> IO ()) -> Text -> IO ()
forall a b. (a -> b) -> a -> b
$
Element -> Text
renderText (Element -> Text) -> Element -> Text
forall a b. (a -> b) -> a -> b
$
SVG -> Options SVG V2 n -> QDiagram SVG V2 n Any -> Result SVG V2 n
forall b (v :: * -> *) n m.
(Backend b v n, HasLinearMap v, Metric v, Typeable n,
OrderedField n, Monoid' m) =>
b -> Options b v n -> QDiagram b v n m -> Result b v n
renderDia SVG
SVG Options SVG V2 n
options (QDiagram SVG V2 n Any -> Result SVG V2 n)
-> QDiagram SVG V2 n Any -> Result SVG V2 n
forall a b. (a -> b) -> a -> b
$
n -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any
forall (v :: * -> *) n m b.
(Metric v, OrderedField n, Monoid' m) =>
n -> QDiagram b v n m -> QDiagram b v n m
pad n
1.1 QDiagram SVG V2 n Any
diagram
defaultOptions :: (SVGFloat n) => Options SVG V2 n
defaultOptions :: forall n. SVGFloat n => Options SVG V2 n
defaultOptions = SizeSpec V2 n
-> Maybe Element -> Text -> [Attribute] -> Bool -> Options SVG V2 n
forall n.
SizeSpec V2 n
-> Maybe Element -> Text -> [Attribute] -> Bool -> Options SVG V2 n
SVGOptions (n -> SizeSpec V2 n
forall n. Num n => n -> SizeSpec V2 n
mkWidth n
4096) Maybe Element
forall a. Maybe a
Nothing Text
"" [] Bool
True