packages feed

diagrams-cairo 1.0 → 1.0.1

raw patch · 3 files changed

+22/−11 lines, 3 filesdep +ghc-primdep +hashable

Dependencies added: ghc-prim, hashable

Files

CHANGES.markdown view
@@ -1,3 +1,8 @@+1.0.1: 26 January 2014+----------------------++    - Add `Hashable (Options Cairo R2)` instance+ 1.0: 25 November 2013 --------------------- 
diagrams-cairo.cabal view
@@ -1,5 +1,5 @@ Name:                diagrams-cairo-Version:             1.0+Version:             1.0.1 Synopsis:            Cairo backend for diagrams drawing EDSL Description:         A full-featured backend for rendering                      diagrams using the cairo rendering engine.@@ -63,7 +63,10 @@                        containers >= 0.3 && < 0.6,                        lens >= 3.8 && < 4,                        data-default-class >= 0.0.1 && < 0.1,-                       statestack >= 0.2 && < 0.3+                       statestack >= 0.2 && < 0.3,+                       hashable >= 1.1 && < 1.3+  if impl(ghc < 7.6)+    Build-depends: ghc-prim   default-language:    Haskell2010    if !os(windows)
src/Diagrams/Backend/Cairo/Internal.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DeriveDataTypeable        #-}+{-# LANGUAGE DeriveGeneric             #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts          #-} {-# LANGUAGE FlexibleInstances         #-}@@ -51,21 +52,19 @@ import qualified Graphics.Rendering.Cairo        as C import qualified Graphics.Rendering.Cairo.Matrix as CM +import           Control.Exception               (try)+import           Control.Lens                    hiding (transform, ( # )) import           Control.Monad                   (when) import qualified Control.Monad.StateStack        as SS import           Control.Monad.Trans             (lift, liftIO) import           Data.Default.Class+import qualified Data.Foldable                   as F+import           Data.Hashable                   (Hashable) import           Data.List                       (isSuffixOf) import           Data.Maybe                      (catMaybes, fromMaybe, isJust) import           Data.Tree--import           Control.Lens                    hiding (transform, ( # ))--import           Control.Exception               (try)--import qualified Data.Foldable                   as F- import           Data.Typeable+import           GHC.Generics                    (Generic)  -- | This data declaration is simply used as a token to distinguish --   the cairo backend: (1) when calling functions where the type@@ -89,8 +88,10 @@                 --   action will do nothing, but the @Render ()@                 --   action can be used (/e.g./ to draw to a Gtk                 --   window; see the @diagrams-gtk@ package).-  deriving (Eq, Ord, Read, Show, Bounded, Enum, Typeable)+  deriving (Eq, Ord, Read, Show, Bounded, Enum, Typeable, Generic) +instance Hashable OutputType+ -- | Custom state tracked in the 'RenderM' monad. data CairoState   = CairoState { _accumStyle :: Style R2@@ -141,7 +142,7 @@           , _cairoOutputType :: OutputType -- ^ the output format and associated options           , _cairoBypassAdjust  :: Bool    -- ^ Should the 'adjustDia' step be bypassed during rendering?           }-    deriving Show+    deriving (Show, Generic)    doRender _ (CairoOptions file size out _) (C r) = (renderIO, r')     where r' = runRenderM r@@ -184,6 +185,8 @@ instance Monoid (Render Cairo R2) where   mempty  = C $ return ()   (C rd1) `mappend` (C rd2) = C (rd1 >> rd2)++instance Hashable (Options Cairo R2)  renderRTree :: RTree Cairo R2 a -> Render Cairo R2 renderRTree (Node (RPrim accTr p) _) = render Cairo (transform accTr p)