Update ihaskell-diagrams to diagrams 1.3.

This commit is contained in:
Franklin Chen 2015-05-06 00:51:21 -04:00
parent 44ebe75c0c
commit 284bf18bae
3 changed files with 9 additions and 9 deletions

View File

@ -14,13 +14,13 @@ import Diagrams.Backend.Cairo
import IHaskell.Display
import IHaskell.Display.Diagrams.Animation
instance IHaskellDisplay (QDiagram Cairo R2 Any) where
instance IHaskellDisplay (QDiagram Cairo V2 Double Any) where
display renderable = do
png <- diagramData renderable PNG
svg <- diagramData renderable SVG
return $ Display [png, svg]
diagramData :: Diagram Cairo R2 -> OutputType -> IO DisplayData
diagramData :: Diagram Cairo -> OutputType -> IO DisplayData
diagramData renderable format = do
switchToTmpDir
@ -33,7 +33,7 @@ diagramData renderable format = do
-- Write the image.
let filename = ".ihaskell-diagram." ++ extension format
renderCairo filename (mkSizeSpec (Just imgWidth) (Just imgHeight)) renderable
renderCairo filename (mkSizeSpec2D (Just imgWidth) (Just imgHeight)) renderable
-- Convert to base64.
imgData <- readFile $ fpFromString filename
@ -49,5 +49,5 @@ diagramData renderable format = do
extension PNG = "png"
-- Rendering hint.
diagram :: Diagram Cairo R2 -> Diagram Cairo R2
diagram :: Diagram Cairo -> Diagram Cairo
diagram = id

View File

@ -11,13 +11,13 @@ import Diagrams.Backend.CmdLine (DiagramOpts(..), mainRender)
import IHaskell.Display
instance IHaskellDisplay (QAnimation Cairo R2 Any) where
instance IHaskellDisplay (QAnimation Cairo V2 Double Any) where
display renderable = do
gif <- animationData renderable
return $ Display [html $ "<img src=\"data:image/gif;base64,"
++ gif ++ "\" />"]
animationData :: Animation Cairo R2 -> IO String
animationData :: Animation Cairo V2 Double -> IO String
animationData renderable = do
switchToTmpDir
@ -51,5 +51,5 @@ animationData renderable = do
return . unpack . base64 $ imgData
-- Rendering hint.
animation :: Animation Cairo R2 -> Animation Cairo R2
animation :: Animation Cairo V2 Double -> Animation Cairo V2 Double
animation = id

View File

@ -63,13 +63,13 @@ library
bytestring,
directory,
-- Use diagrams wrapper package to ensure all same versions of subpackages
diagrams==1.2.*,
diagrams >= 1.3,
diagrams-lib,
diagrams-cairo,
ihaskell >= 0.5,
-- The active package, used to represent animations
active >= 0.1.0 && <0.1.1
active >= 0.2
-- Directories containing source files.
-- hs-source-dirs: