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


-- | HTML5 canvas backend for diagrams drawing EDSL
--   
--   This package provides a modular backend for rendering diagrams created
--   with the diagrams EDSL using an HTML5 canvas.
@package diagrams-html5
@version 1.4.1


-- | A full-featured rendering backend for diagrams using HTML5 Canvas.
--   Implemented using the static-canvas package.
--   
--   To invoke the Html5 backend, you have three options.
--   
--   <ul>
--   <li>You can use the <a>Diagrams.Backend.Html5.CmdLine</a> module to
--   create standalone executables which will display the diagram in a
--   browser using a web service.</li>
--   <li>You can use the <a>renderHtml5</a> function provided by this
--   module, which gives you more programmatic control over when and how
--   images are displayed (making it east to, for example, write a single
--   program that displays multiple images, or one that diaplays images
--   dynamically based on user input, and so on).</li>
--   <li>For the most flexiblity you can invoke the <a>renderDia</a> method
--   from <a>Backend</a> instance for <tt>Html5</tt>. In particular,
--   <a>renderDia</a> has the generic type</li>
--   </ul>
--   
--   <pre>
--   renderDia :: b -&gt; Options b v -&gt; QDiagram b v m -&gt; Result b v
--   </pre>
--   
--   (omitting a few type class contraints). <tt>b</tt> represents the
--   backend type, <tt>v</tt> the vector space, and <tt>m</tt> the type of
--   monoidal query annotations on the diagram. <a>Options</a> and
--   <a>Result</a> are associated data and type families, respectively,
--   which yield the type of option records and rendering results specific
--   to any particular backend. For <tt>b ~ Html5</tt> and <tt>v ~ R2</tt>,
--   we have
--   
--   <pre>
--   data Options Html5 V2 Double = Html5Options
--    { _size :: SizeSpec V2 -- ^^ The requested size
--    }
--   </pre>
--   
--   <pre>
--   data family Render Html5 V2 Double = C (RenderM ())
--   </pre>
--   
--   <pre>
--   type family Result Html5 V2 Double = Html5 ()
--   </pre>
--   
--   So the type of <a>renderDia</a> resolves to
--   
--   <pre>
--   renderDia :: Html5 -&gt; Options Html5 V2 Double -&gt; QDiagram Html5 V2 Double m -&gt;
--   Html5()
--   </pre>
--   
--   which you could call like <tt>renderDia Html5 (Html5Options (width
--   250)) myDiagram</tt>
module Diagrams.Backend.Html5

-- | This data declaration is simply used as a token to distinguish this
--   rendering engine.
data Html5
Html5 :: Html5
type B = Html5

-- | Backend-specific rendering options.
renderHtml5 :: FilePath -> SizeSpec V2 Double -> QDiagram Html5 V2 Double Any -> IO ()

-- | Output size.
size :: Lens' (Options Html5 V2 Double) (SizeSpec V2 Double)

-- | "id" for the <tt><a>canvas</a></tt> element (prepended to
--   "StaticCanvas"). Only applies to non-<a>standalone</a> diagrams.
canvasId :: Lens' (Options Html5 V2 Double) String

-- | Should the output be a standalone html file. Otherwise the output is a
--   <tt><a>canvas</a></tt> element followed by a <tt><a>script</a></tt>
--   calling the canvas.
standalone :: Lens' (Options Html5 V2 Double) Bool
instance Diagrams.Core.Types.Backend Diagrams.Backend.Html5.Html5 Linear.V2.V2 GHC.Types.Double
instance Data.Default.Class.Default Diagrams.Backend.Html5.Html5State
instance GHC.Base.Semigroup (Diagrams.Core.Types.Render Diagrams.Backend.Html5.Html5 Linear.V2.V2 GHC.Types.Double)
instance GHC.Base.Monoid (Diagrams.Core.Types.Render Diagrams.Backend.Html5.Html5 Linear.V2.V2 GHC.Types.Double)
instance Diagrams.Core.Types.Renderable (Diagrams.Segment.Segment Diagrams.Segment.Closed Linear.V2.V2 GHC.Types.Double) Diagrams.Backend.Html5.Html5
instance Diagrams.Core.Types.Renderable (Diagrams.Trail.Trail Linear.V2.V2 GHC.Types.Double) Diagrams.Backend.Html5.Html5
instance Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 GHC.Types.Double) Diagrams.Backend.Html5.Html5
instance Diagrams.Core.Types.Renderable (Diagrams.TwoD.Text.Text GHC.Types.Double) Diagrams.Backend.Html5.Html5
instance Diagrams.Core.Types.Renderable (Diagrams.TwoD.Image.DImage GHC.Types.Double Diagrams.TwoD.Image.External) Diagrams.Backend.Html5.Html5
instance GHC.Show.Show Diagrams.Backend.Html5.Html5
instance GHC.Read.Read Diagrams.Backend.Html5.Html5
instance GHC.Classes.Ord Diagrams.Backend.Html5.Html5
instance GHC.Classes.Eq Diagrams.Backend.Html5.Html5


-- | Convenient creation of command-line-driven executables for rendering
--   diagrams using the Html5 backend.
--   
--   <ul>
--   <li><a>defaultMain</a> creates an executable which can render a single
--   diagram at various options.</li>
--   <li><a>multiMain</a> is like <a>defaultMain</a> but allows for a list
--   of diagrams from which the user can choose one to render.</li>
--   <li><a>mainWith</a> is a generic form that does all of the above but
--   with a slightly scarier type. See <a>Diagrams.Backend.CmdLine</a>.
--   This form can also take a function type that has a suitable final
--   result (any of arguments to the above types) and <a>Parseable</a>
--   arguments.</li>
--   </ul>
--   
--   If you want to generate diagrams programmatically---<i>i.e.</i> if you
--   want to do anything more complex than what the below functions
--   provide---you have several options.
--   
--   <ul>
--   <li>Use a function with <a>mainWith</a>. This may require making
--   <a>Parseable</a> instances for custom argument types.</li>
--   <li>Make a new <a>Mainable</a> 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.</li>
--   <li>Build option records and pass them along with a diagram to
--   <a>mainRender</a> from <a>Diagrams.Backend.CmdLine</a>.</li>
--   </ul>
--   
--   For a tutorial on command-line diagram creation see
--   <a>http://projects.haskell.org/diagrams/doc/cmdline.html</a>.
module Diagrams.Backend.Html5.CmdLine

-- | Main entry point for command-line diagram creation. This is the method
--   that users will call from their program <tt>main</tt>. For instance an
--   expected user program would take the following form.
--   
--   <pre>
--   import Diagrams.Prelude
--   import Diagrams.Backend.TheBestBackend.CmdLine
--   
--   d :: Diagram B R2
--   d = ...
--   
--   main = mainWith d
--   </pre>
--   
--   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 :: QDiagram Html5 V2 Double Any -> IO ()
multiMain :: [(String, QDiagram Html5 V2 Double Any)] -> IO ()

-- | This data declaration is simply used as a token to distinguish this
--   rendering engine.
data Html5
type B = Html5
instance Diagrams.Backend.CmdLine.Mainable (Diagrams.Core.Types.QDiagram Diagrams.Backend.Html5.Html5 Linear.V2.V2 GHC.Types.Double Data.Semigroup.Internal.Any)
instance Diagrams.Backend.CmdLine.Mainable [(GHC.Base.String, Diagrams.Core.Types.QDiagram Diagrams.Backend.Html5.Html5 Linear.V2.V2 GHC.Types.Double Data.Semigroup.Internal.Any)]
