-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | SVG backend for diagrams drawing EDSL.
--   
--   This package provides a modular backend for rendering diagrams created
--   with the diagrams EDSL to SVG files. It uses blaze-svg to be
--   a fast, native Haskell backend, making it suitable for use on any
--   platform.
--   
--   The package provides the following modules:
--   
--   
--   
- Diagrams.Backend.SVG.CmdLine - if you're just getting
--   started with diagrams, begin here.
--   
- Diagrams.Backend.SVG - look at this next. The general API
--   for the SVG backend.
--   
--   
--   Additional documentation can be found in the README file distributed
--   with the source tarball or viewable on GitHub:
--   https://github.com/diagrams/diagrams-svg/blob/master/README.md.
@package diagrams-svg
@version 0.8.0.2

-- | A full-featured rendering backend for diagrams producing SVG files,
--   implemented natively in Haskell (making it easy to use on any
--   platform).
--   
--   To invoke the SVG backend, you have three options.
--   
--   
--   
- You can use the Diagrams.Backend.SVG.CmdLine module to
--   create standalone executables which output SVG images when
--   invoked.
--   
- You can use the renderSVG 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 SVG value directly in memory without writing it to disk),
--   you can manually invoke the renderDia method from the
--   Backend instance for SVG. 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 ~ SVG and v ~ R2,
--   we have
--   
--   
--   data Options SVG R2 = SVGOptions
--                         { size :: SizeSpec2D   -- ^ The requested size.
--                         , svgDefinitions :: Maybe S.Svg
--                         -- ^ Custom definitions that will be added to the @defs@ 
--                         --  section of the output.
--                         }
--   
--   
--   
--   data family Render SVG R2 = R SvgRenderM
--   
--   
--   
--   type family Result SVG R2 = Svg
--   
--   
--   So the type of renderDia resolves to
--   
--   
--   renderDia :: SVG -> Options SVG R2 -> QDiagram SVG R2 m -> Svg
--   
--   
--   which you could call like renderDia SVG (SVGOptions (Width 250))
--   myDiagram. (In some situations GHC may not be able to infer the
--   type m, in which case you can use a type annotation to
--   specify it; it may be useful to simply use the type synonym
--   Diagram SVG R2 = QDiagram SVG R2 Any.) This returns an
--   Svg value, which you can, e.g. render to a
--   ByteString using renderSvg.
module Diagrams.Backend.SVG

-- | SVG is simply a token used to identify this rendering backend
--   (to aid type inference).
data SVG
SVG :: SVG

-- | Backend-specific rendering options.

-- | Render a diagram as an SVG, writing to the specified output file and
--   using the requested size.
renderSVG :: FilePath -> SizeSpec2D -> Diagram SVG R2 -> IO ()
instance Typeable SVG
instance Show SVG
instance Renderable Text SVG
instance Renderable (Path R2) SVG
instance Renderable (Trail R2) SVG
instance Renderable (Segment Closed R2) SVG
instance Show (Options SVG R2)
instance Backend SVG R2
instance Monoid (Render SVG R2)

-- | Convenient creation of command-line-driven executables for rendering
--   diagrams using the SVG backend.
--   
--   
--   
- defaultMain creates an executable which can render a single
--   diagram at various options.
--   
- multiMain is like defaultMain but allows for a list
--   of diagrams from which the user can choose one to render.
--   
--   
--   If you want to generate diagrams programmatically---i.e. if you
--   want to do anything more complex than what the below functions
--   provide---you have several options.
--   
--   
--   
- A simple but somewhat inflexible approach is to wrap up
--   defaultMain (or multiMain) in a call to
--   withArgs.
--   
- You can use renderSVG to render a diagram to a file
--   directly; see Diagrams.Backend.SVG.
--   
- A more flexible approach is to directly call renderDia; see
--   Diagrams.Backend.SVG for more information.
--   
module Diagrams.Backend.SVG.CmdLine

-- | This is the simplest way to render diagrams, and is intended to be
--   used like so:
--   
--   
--   ... definitions ...
--   
--   main = defaultMain myDiagram
--   
--   
--   Compiling this file will result in an executable which takes various
--   command-line options for setting the size, output file, and so on, and
--   renders myDiagram with the specified options.
--   
--   Pass --help to the generated executable to see all available
--   options.
defaultMain :: Diagram SVG R2 -> IO ()

-- | multiMain is like defaultMain, except instead of a
--   single diagram it takes a list of diagrams paired with names as input.
--   The generated executable then takes an argument specifying the name of
--   the diagram that should be rendered. This is a convenient way to
--   create an executable that can render many different diagrams without
--   modifying the source code in between each one.
multiMain :: [(String, Diagram SVG R2)] -> IO ()

-- | SVG is simply a token used to identify this rendering backend
--   (to aid type inference).
data SVG
instance Typeable DiagramOpts
instance Show DiagramOpts
instance Data DiagramOpts
