-- 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 lucid-svg to be
--   a 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 1.4.3.1

-- | 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 or renderPretty functions
--   provided by this module, which give 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). The
--   only difference between the two functions is that renderPretty,
--   pretty prints the SVG output.
--   
- 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 n -> QDiagram b v n m -> Result b v n
--   
--   
--   (omitting a few type class constraints). b represents the
--   backend type, v the vector space, n the numerical
--   field, 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, v ~ V2, we have
--   
--   
--   data    Options SVG V2 n = SVGOptions
--       { _size            :: SizeSpec V2 n   -- ^ The requested size.
--       , _svgDefinitions  :: Maybe Element
--                             -- ^ Custom definitions that will be added to the @defs@
--                             --   section of the output.
--       , _idPrefix        :: T.Text
--       , _svgAttributes   :: [Attribute]
--                             -- ^ Attributes to apply to the entire svg element.
--       , _generateDoctype :: Bool
--       }
--   
--   
--   
--   data family Render SVG V2 n = R 'SvgRenderM n'
--   
--   
--   
--   type family Result SVG V2 n = Element
--   
--   
--   So the type of renderDia resolves to
--   
--   
--   renderDia :: SVG -> Options SVG V2 n -> QDiagram SVG V2 n m -> Element
--   
--   
--   which you could call like renderDia SVG (SVGOptions (mkWidth 250)
--   Nothing "" [] True) myDiagram (if you have the
--   OverloadedStrings extension enabled; otherwise you can use
--   'Text.pack ""'). (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 = QDiagram SVG V2 Double Any.) This returns an
--   Element value, which you can, e.g. render to a
--   ByteString using renderBS from the 'svg-builder'
--   package.
module Diagrams.Backend.SVG

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

-- | Backend-specific rendering options.
data family Options b (v :: Type -> Type) n

-- | Lens onto the size of the svg options.
sizeSpec :: Lens' (Options SVG V2 n) (SizeSpec V2 n)

-- | Lens onto the svg definitions of the svg options.
svgDefinitions :: Lens' (Options SVG V2 n) (Maybe Element)

-- | Lens onto the idPrefix of the svg options. This is the prefix given to
--   clipping paths to distinguish them from other svg files in the same
--   web page.
idPrefix :: Lens' (Options SVG V2 n) Text

-- | Lens onto the svgAttributes field of the svg options. This field is
--   provided to supply SVG attributes to the entire diagram.
svgAttributes :: Lens' (Options SVG V2 n) [Attribute]

-- | Lens onto the generateDoctype field of the svg options. Set to False
--   if you don't want a doctype tag included in the output.
generateDoctype :: Lens' (Options SVG V2 n) Bool

-- | Set the class for a particular SVG diagram
svgClass :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any

-- | Set the id for a particular SVG diagram
svgId :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any

-- | Set the title text for a particular SVG diagram
svgTitle :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any

-- | Constaint on number type that diagrams-svg can use to render an SVG.
--   This includes the common number types: Double, Float
type SVGFloat n = (Show n, TypeableFloat n)

-- | Render a diagram as an SVG, writing to the specified output file and
--   using the requested size.
renderSVG :: SVGFloat n => FilePath -> SizeSpec V2 n -> QDiagram SVG V2 n Any -> IO ()

-- | Render a diagram as an SVG, writing to the specified output file and
--   using the backend options. The id prefix is derived from the basename
--   of the output file.
renderSVG' :: SVGFloat n => FilePath -> Options SVG V2 n -> QDiagram SVG V2 n Any -> IO ()

-- | Render a diagram as a pretty printed SVG.
renderPretty :: SVGFloat n => FilePath -> SizeSpec V2 n -> QDiagram SVG V2 n Any -> IO ()

-- | Render a diagram as a pretty printed SVG to the specified output file
--   and using the backend options. The id prefix is derived from the
--   basename of the output file.
renderPretty' :: SVGFloat n => FilePath -> Options SVG V2 n -> QDiagram SVG V2 n Any -> IO ()

-- | Load images (JPGPNG...) in a SVG specific way.
loadImageSVG :: SVGFloat n => FilePath -> IO (QDiagram SVG V2 n Any)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Diagrams.Core.Types.Options Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Core.Types.Renderable (Diagrams.TwoD.Image.DImage n (Diagrams.TwoD.Image.Native Diagrams.Backend.SVG.Img)) Diagrams.Backend.SVG.SVG
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Core.Types.Backend Diagrams.Backend.SVG.SVG Linear.V2.V2 n
instance GHC.Base.Semigroup (Diagrams.Core.Types.Render Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
instance GHC.Base.Monoid (Diagrams.Core.Types.Render Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) Diagrams.Backend.SVG.SVG
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Core.Types.Renderable (Diagrams.TwoD.Text.Text n) Diagrams.Backend.SVG.SVG
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Core.Types.Renderable (Diagrams.TwoD.Image.DImage n Diagrams.TwoD.Image.Embedded) Diagrams.Backend.SVG.SVG
instance Data.Hashable.Class.Hashable n => Data.Hashable.Class.Hashable (Diagrams.Core.Types.Options Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
instance GHC.Classes.Eq Graphics.Svg.Core.Element
instance GHC.Show.Show Diagrams.Backend.SVG.SVG

-- | 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.
--   
- mainWith is a generic form that does all of the above but
--   with a slightly scarier type. See Diagrams.Backend.CmdLine.
--   This form can also take a function type that has a subtable final
--   result (any of arguments to the above types) and Parseable
--   arguments.
--   
--   
--   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.
--   
--   
--   
- Use a function with mainWith. This may require making
--   Parseable instances for custom argument types.
--   
- Make a new Mainable instance. This may require a newtype
--   wrapper on your diagram type to avoid the existing instances. This
--   gives you more control over argument parsing, intervening steps, and
--   diagram creation.
--   
- Build option records and pass them along with a diagram to
--   mainRender from Diagrams.Backend.CmdLine.
--   
- 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.
--   
--   
--   For a tutorial on command-line diagram creation see
--   https://diagrams.github.io/doc/cmdline.html.
module Diagrams.Backend.SVG.CmdLine

-- | Main entry point for command-line diagram creation. This is the method
--   that users will call from their program main. For instance an
--   expected user program would take the following form.
--   
--   
--   import Diagrams.Prelude
--   import Diagrams.Backend.TheBestBackend.CmdLine
--   
--   d :: Diagram B R2
--   d = ...
--   
--   main = mainWith d
--   
--   
--   Most backends should be able to use the default implementation. A
--   different implementation should be used to handle more complex
--   interactions with the user.
mainWith :: Mainable d => d -> IO ()
defaultMain :: SVGFloat n => QDiagram SVG V2 n Any -> IO ()
multiMain :: SVGFloat n => [(String, QDiagram SVG V2 n Any)] -> IO ()

-- | SVG is simply a token used to identify this rendering backend
--   (to aid type inference).
data SVG
type B = SVG
instance Diagrams.Backend.CmdLine.Parseable Diagrams.Backend.SVG.CmdLine.PrettyOpt
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Backend.CmdLine.Mainable (Diagrams.Core.Types.QDiagram Diagrams.Backend.SVG.SVG Linear.V2.V2 n Data.Semigroup.Internal.Any)
instance Graphics.Rendering.SVG.SVGFloat n => Diagrams.Backend.CmdLine.Mainable [(GHC.Base.String, Diagrams.Core.Types.QDiagram Diagrams.Backend.SVG.SVG Linear.V2.V2 n Data.Semigroup.Internal.Any)]
