Chart-cairo 1.3.3 → 1.9.4.1
raw patch · 2 files changed
Files
Chart-cairo.cabal view
@@ -1,5 +1,5 @@ Name: Chart-cairo-Version: 1.3.3+Version: 1.9.4.1 License: BSD3 License-file: LICENSE Copyright: Tim Docker, 2006-2014@@ -9,19 +9,22 @@ Synopsis: Cairo backend for Charts. Description: Cairo backend for Charts. Category: Graphics-Cabal-Version: >= 1.6+Cabal-Version: 1.18 Build-Type: Simple library+ default-language: Haskell98 Build-depends: base >= 3 && < 5- , old-locale- , time, mtl, array- , cairo >= 0.9.11+ , array >= 0.5 && < 0.6+ , old-locale >= 1.0.0 && < 1.1+ , time >= 1.12 && < 1.13+ , cairo >= 0.9.11 && < 0.14 , colour >= 2.2.1 && < 2.4- , data-default-class < 0.1+ , data-default-class < 0.2 , operational >= 0.2.2 && < 0.3- , lens >= 3.9 && < 4.8- , Chart >= 1.3 && < 1.4+ , lens >= 3.9 && < 5.3+ , Chart >= 1.9 && < 1.10+ , mtl >= 2.0 && < 2.4 Exposed-modules: Graphics.Rendering.Chart.Backend.Cairo
Graphics/Rendering/Chart/Backend/Cairo.hs view
@@ -28,6 +28,7 @@ import Control.Lens(makeLenses) import Control.Monad.Reader import Control.Monad.Operational+import Control.Monad import qualified Graphics.Rendering.Cairo as C import qualified Graphics.Rendering.Cairo.Matrix as CM@@ -70,11 +71,11 @@ -- | Run this backends renderer. runBackend :: CEnv -- ^ Environment to start rendering with.- -> ChartBackend a -- ^ Chart render code.+ -> BackendProgram a -- ^ Chart render code. -> C.Render a -- ^ Cairo render code. runBackend env m = runBackend' env (withDefaultStyle m) -runBackend' :: CEnv -> ChartBackend a -> C.Render a+runBackend' :: CEnv -> BackendProgram a -> C.Render a runBackend' env m = eval env (view m) where eval :: CEnv -> ProgramView ChartBackendInstr a -> C.Render a@@ -90,7 +91,7 @@ eval env (WithLineStyle ls p :>>= f) = cWithLineStyle env ls p >>= step env f eval env (WithClipRegion r p :>>= f) = cWithClipRegion env r p >>= step env f - step :: CEnv -> (v -> ChartBackend a) -> v -> C.Render a+ step :: CEnv -> (v -> BackendProgram a) -> v -> C.Render a step env f = \v -> runBackend' env (f v) walkPath :: Path -> C.Render ()@@ -130,12 +131,12 @@ C.moveTo 0 0 C.showText text -cWithTransform :: CEnv -> Matrix -> ChartBackend a -> C.Render a+cWithTransform :: CEnv -> Matrix -> BackendProgram a -> C.Render a cWithTransform env m p = preserveCState0 $ do C.transform (convertMatrix m) runBackend' env p -cWithFontStyle :: CEnv -> FontStyle -> ChartBackend a -> C.Render a+cWithFontStyle :: CEnv -> FontStyle -> BackendProgram a -> C.Render a cWithFontStyle env font p = preserveCState0 $ do C.selectFontFace (G._font_name font) (convertFontSlant $ G._font_slant font) @@ -143,11 +144,11 @@ C.setFontSize (G._font_size font) runBackend' env{ceFontColor=G._font_color font} p -cWithFillStyle :: CEnv -> FillStyle -> ChartBackend a -> C.Render a+cWithFillStyle :: CEnv -> FillStyle -> BackendProgram a -> C.Render a cWithFillStyle env fs p = do runBackend' env{ceFillColor=G._fill_color fs} p -cWithLineStyle :: CEnv -> LineStyle -> ChartBackend a -> C.Render a+cWithLineStyle :: CEnv -> LineStyle -> BackendProgram a -> C.Render a cWithLineStyle env ls p = preserveCState0 $ do C.setLineWidth (G._line_width ls) C.setLineCap (convertLineCap $ G._line_cap ls)@@ -155,7 +156,7 @@ C.setDash (G._line_dashes ls) 0 runBackend' env{cePathColor=G._line_color ls} p -cWithClipRegion :: CEnv -> Rect -> ChartBackend a -> C.Render a+cWithClipRegion :: CEnv -> Rect -> BackendProgram a -> C.Render a cWithClipRegion env r p = preserveCState0 $ do setClipRegion r runBackend' env p@@ -193,7 +194,7 @@ -- | Generate an image file for the given drawing instructions, at the specified path. Size and -- format are set through the `FileOptions` parameter.-cBackendToFile :: FileOptions -> ChartBackend a -> FilePath -> IO a+cBackendToFile :: FileOptions -> BackendProgram a -> FilePath -> IO a cBackendToFile fo cr path = do case (_fo_format fo) of PS -> write C.withPSSurface