diagrams-cairo 1.3.1.2 → 1.5
raw patch · 5 files changed
Files
- CHANGELOG.md +64/−0
- README.markdown +5/−0
- diagrams-cairo.cabal +25/−26
- src/Diagrams/Backend/Cairo/CmdLine.hs +13/−12
- src/Diagrams/Backend/Cairo/Internal.hs +14/−7
CHANGELOG.md view
@@ -1,3 +1,67 @@+## [v1.5](https://github.com/diagrams/diagrams-cairo/tree/v1.5) (2025-06-16)++- Allow `diagrams-lib-1.5` and remove `DiagramLoopOpts` which is no+ longer supported+- Allow `optparse-applicative-0.19`++## [v1.4.3](https://github.com/diagrams/diagrams-cairo/tree/v1.4.3) (2024-11-06)++- Require `data-default-0.8`++## [v1.4.2.1-r3](https://github.com/diagrams/diagrams-cairo/tree/v1.4.2.1-r3) (2024-08-13)++- Allow `base-4.20`, `containers-0.7`, `lens-5.3`, `hashable-1.5`+- Test on GHC 9.10++## [v1.4.2.1-r2](https://github.com/diagrams/diagrams-cairo/tree/v1.4.2.1-r2) (2024-02-13)++- Allow `base-4.19`+- Test on GHC 9.8++## [v1.4.2.1-r1](https://github.com/diagrams/diagrams-cairo/tree/v1.4.2.1-r1) (2023-08-16)++- Allow `bytestring-0.12`++## [v1.4.2.1](https://github.com/diagrams/diagrams-cairo/tree/v1.4.2.1) (2023-07-10)++- Allow `base-4.18`, `mtl-2.3`, `optparse-applicative-0.18`,+ `unix-2.8`+- Test with GHC 9.4 and 9.6++## [v1.4.2](https://github.com/diagrams/diagrams-cairo/tree/v1.4.2) (2022-01-26)++- Test with GHC 9.0 (requires `--allow-newer`)+- Allow `base-4.15`, `lens-5.1`, `bytestring-0.11`,+ `transformers-0.6`, `hashable-1.4`+- Add `Eq Options` instance required for `Hashable`++- r1 (6 Feb 2022): allow `optparse-applicative-0.17`+- r2 (19 Aug 2022): allow `vector-0.13`+- r3 (4 Jan 2023): allow `lens-5.2`, test with GHC 9.2, drop official support for GHC < 8.8++## [v1.4.1.1](https://github.com/diagrams/diagrams-cairo/tree/v1.4.1.1) (2019-01-11)++- Drop GHC 7.10 and 8.0 support+- Test with GHC 8.6 and 8.8++- r1: allow `lens-4.19` and `linear-1.21`+- r2: allow `base-4.14`, `diagrams-core-1.5`, `lens-5.0`,+ `optparse-applicative-0.16`++## [v1.4.1](https://github.com/diagrams/diagrams-cairo/tree/v1.4.1) (2018-05-17)++- Allow `base-4.11` and `lens-4.16`+- Add `Semigroup` instance for `Render Cairo V2 Double`+- Drop GHC 7.8 support++## [v1.4](https://github.com/diagrams/diagrams-cairo/tree/v1.4) (2016-10-26)++- No significant changes, just bumping version for diagrams 1.4+ release++- Allow `vector-0.12` (Hackage revision 1)+- Allow `base-4.10` and `optparse-applicative-0.14` (Hackage rev 2)+ ## [v1.3.1.2](https://github.com/diagrams/diagrams-cairo/tree/v1.3.1.2) (2016-08-22) - Require `optparse-applicative-0.13` and fix compilation error
README.markdown view
@@ -23,9 +23,14 @@ A simple example that uses _diagrams-cairo_ to draw a blue circle: ```haskell+{-# LANGUAGE NoMonomorphismRestriction #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE TypeFamilies #-}+ import Diagrams.Prelude import Diagrams.Backend.Cairo.CmdLine +d :: Diagram B d = circle 1 # fc blue main = mainWith (pad 1.1 d)
diagrams-cairo.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-cairo-Version: 1.3.1.2+Version: 1.5 Synopsis: Cairo backend for diagrams drawing EDSL Description: A full-featured backend for rendering diagrams using the cairo rendering engine.@@ -30,7 +30,7 @@ . * "Diagrams.Backend.Cairo.Ptr" - render diagrams to buffers in memory.-Homepage: http://projects.haskell.org/diagrams+Homepage: https://diagrams.github.io License: BSD3 License-file: LICENSE Author: Brent Yorgey@@ -38,9 +38,10 @@ Bug-reports: http://github.com/diagrams/diagrams-cairo/issues Category: Graphics Build-type: Simple-Cabal-version: >=1.10-Extra-source-files: CHANGELOG.md, README.markdown-Tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1+Cabal-version: 2.0+Extra-source-files: README.markdown+Extra-doc-files: CHANGELOG.md+Tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.5 || ==9.8.2 || ==9.10.1 Source-repository head type: git location: http://github.com/diagrams/diagrams-cairo.git@@ -53,31 +54,29 @@ Diagrams.Backend.Cairo.Ptr Diagrams.Backend.Cairo.Text Hs-source-dirs: src- Build-depends: base >= 4.2 && < 4.10,- mtl >= 2.0 && < 2.3,+ Build-depends: base >=4.2 && <4.21,+ mtl >=2.0 && <2.4, filepath,- diagrams-core >= 1.3 && < 1.4,- diagrams-lib >= 1.3 && < 1.4,- cairo >= 0.12.4 && < 0.14,- pango >= 0.12.5 && < 0.14,+ diagrams-core >=1.3 && <1.6,+ diagrams-lib >=1.3 && <1.6,+ cairo >=0.12.4 && <0.14,+ pango >=0.12.5 && <0.14, colour,- split >= 0.1.2 && < 0.3,- containers >= 0.3 && < 0.6,- lens >= 3.8 && < 4.15,- data-default-class >= 0.0.1 && < 0.2,- statestack >= 0.2 && < 0.3,- JuicyPixels >= 3.1.3.2 && < 3.3,- vector >= 0.10.0 && < 0.12,- array >= 0.4.0 && < 0.6,- bytestring >= 0.9 && < 0.11,- optparse-applicative >= 0.13 && < 0.14,- transformers >= 0.3 && <0.6,- hashable >= 1.1 && < 1.3- if impl(ghc < 7.6)- Build-depends: ghc-prim+ split >=0.1.2 && <0.3,+ containers >=0.3 && <0.8,+ lens >=3.8 && <5.4,+ data-default >=0.8 && <0.9,+ statestack >=0.2 && <0.4,+ JuicyPixels >=3.1.3.2 && <3.4,+ vector >=0.10.0 && <0.14,+ array >=0.4.0 && <0.6,+ bytestring >=0.9 && <0.12 || ^>=0.12.0,+ optparse-applicative >=0.13 && <0.20,+ transformers >=0.3 && <0.7,+ hashable >=1.1 && <1.6 default-language: Haskell2010 if !os(windows) cpp-options: -DCMDLINELOOP- Build-depends: unix >= 2.4 && < 2.8+ Build-depends: unix >=2.4 && <2.9
src/Diagrams/Backend/Cairo/CmdLine.hs view
@@ -54,7 +54,7 @@ -- information. -- -- For a tutorial on command-line diagram creation see--- <http://projects.haskell.org/diagrams/doc/cmdline.html>.+-- <https://diagrams.github.io/doc/cmdline.html>. -- ----------------------------------------------------------------------------- @@ -110,6 +110,14 @@ import Data.List.Split +-- | Extra options for animated GIFs.+data GifOpts = GifOpts { _dither :: Bool+ , _noLooping :: Bool+ , _loopRepeat :: Maybe Int}++makeLenses ''GifOpts++ -- $mainwith -- The 'mainWith' method unifies all of the other forms of @main@ and is now -- the recommended way to build a command-line diagrams program. It works as a@@ -185,9 +193,9 @@ defaultMain = mainWith instance Mainable (QDiagram Cairo V2 Double Any) where- type MainOpts (QDiagram Cairo V2 Double Any) = (DiagramOpts, DiagramLoopOpts)+ type MainOpts (QDiagram Cairo V2 Double Any) = DiagramOpts - mainRender (opts, l) d = chooseRender opts d >> defaultLoopRender l+ mainRender opts d = chooseRender opts d chooseRender :: DiagramOpts -> QDiagram Cairo V2 Double Any -> IO () chooseRender opts d =@@ -262,9 +270,9 @@ animMain = mainWith instance Mainable (Animation Cairo V2 Double) where- type MainOpts (Animation Cairo V2 Double) = ((DiagramOpts, DiagramAnimOpts), DiagramLoopOpts)+ type MainOpts (Animation Cairo V2 Double) = (DiagramOpts, DiagramAnimOpts) - mainRender (opts, l) d = defaultAnimMainRender chooseRender output opts d >> defaultLoopRender l+ mainRender opts d = defaultAnimMainRender chooseRender output opts d -- | @gifMain@ takes a list of diagram and delay time pairs and produces a -- command line program to generate an animated GIF, with options @GifOpts@.@@ -294,13 +302,6 @@ -- @ gifMain :: [(QDiagram Cairo V2 Double Any, GifDelay)] -> IO () gifMain = mainWith---- | Extra options for animated GIFs.-data GifOpts = GifOpts { _dither :: Bool- , _noLooping :: Bool- , _loopRepeat :: Maybe Int}--makeLenses ''GifOpts -- | Command line parser for 'GifOpts'. -- @--dither@ turn dithering on.
src/Diagrams/Backend/Cairo/Internal.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ExistentialQuantification #-}@@ -5,11 +6,12 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE ViewPatterns #-}-{-# LANGUAGE ScopedTypeVariables #-} ----------------------------------------------------------------------------- -- |@@ -53,7 +55,8 @@ import qualified Graphics.Rendering.Pango as P import Codec.Picture-import Codec.Picture.Types (convertImage, promoteImage, packPixel)+import Codec.Picture.Types (convertImage, packPixel,+ promoteImage) import Control.Exception (try)@@ -61,15 +64,15 @@ import Control.Monad.IO.Class import qualified Control.Monad.StateStack as SS import Control.Monad.Trans (lift)+import qualified Data.Array.MArray as MA+import Data.Bits (rotateL, (.&.)) import qualified Data.Foldable as F import Data.Hashable (Hashable (..)) import Data.List (isSuffixOf) import Data.Maybe (catMaybes, fromMaybe, isJust) import Data.Tree import Data.Typeable-import qualified Data.Array.MArray as MA import Data.Word (Word32)-import Data.Bits (rotateL, (.&.)) import GHC.Generics (Generic) -- | This data declaration is simply used as a token to distinguish@@ -151,7 +154,7 @@ , _cairoOutputType :: OutputType -- ^ the output format and associated options , _cairoBypassAdjust :: Bool -- ^ Should the 'adjustDia' step be bypassed during rendering? }- deriving (Show)+ deriving (Show, Eq) renderRTree _ opts t = (renderIO, r) where@@ -177,9 +180,14 @@ runC :: Render Cairo V2 Double -> RenderM () runC (C r) = r +instance Semigroup (Render Cairo V2 Double) where+ C rd1 <> C rd2 = C (rd1 >> rd2)+ instance Monoid (Render Cairo V2 Double) where mempty = C $ return ()- (C rd1) `mappend` (C rd2) = C (rd1 >> rd2)+#if !(MIN_VERSION_base(4,11,0))+ mappend = (<>)+#endif instance Hashable (Options Cairo V2 Double) where hashWithSalt s (CairoOptions fn sz out adj)@@ -254,7 +262,6 @@ fromFontSlant FontSlantOblique = P.StyleOblique fromFontWeight :: FontWeight -> P.Weight-fromFontWeight FontWeightNormal = P.WeightNormal fromFontWeight FontWeightBold = P.WeightBold fromFontWeight _ = P.WeightNormal