diagrams-rasterific 1.4 → 1.4.1
raw patch · 7 files changed
+82/−9 lines, 7 filesdep +diagrams-rasterificdep ~basedep ~lensPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: diagrams-rasterific
Dependency ranges changed: base, lens
API changes (from Hackage documentation)
+ Diagrams.Backend.Rasterific: instance Data.Semigroup.Semigroup (Diagrams.Core.Types.Render Diagrams.Backend.Rasterific.Rasterific Linear.V2.V2 n)
- Diagrams.Backend.Rasterific: size :: ((~) (* -> *) (V a) v, (~) * (N a) n, Enveloped a, HasBasis v) => a -> v n
+ Diagrams.Backend.Rasterific: size :: ((~) (* -> *) V a v, (~) * N a n, Enveloped a, HasBasis v) => a -> v n
- Diagrams.Backend.Rasterific.CmdLine: mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO ()
+ Diagrams.Backend.Rasterific.CmdLine: mainWith :: (Mainable d, Parseable MainOpts d) => d -> IO ()
Files
- CHANGELOG.md +8/−0
- diagrams-rasterific.cabal +28/−6
- src/Diagrams/Backend/Rasterific.hs +10/−3
- src/Diagrams/Backend/Rasterific/CmdLine.hs +1/−0
- src/Diagrams/Backend/Rasterific/Text.hs +1/−0
- test/test0.hs +14/−0
- test/test1.hs +20/−0
CHANGELOG.md view
@@ -1,3 +1,11 @@+## [v1.4.1](https://github.com/diagrams/diagrams-rasterific/tree/v1.4.1) (2018-05-09)++ - Bug fix: stroke entire paths at once ([#42](https://github.com/diagrams/diagrams-rasterific/issues/42))+ - New `Semigroup (Render Rasterific V2 n)` instance+ - Allow:+ - `base-4.11` (GHC 8.4)+ - `lens-4.16`+ ## [v1.4](https://github.com/diagrams/diagrams-rasterific/tree/v1.4) (2016-10-26) * **New features**
diagrams-rasterific.cabal view
@@ -1,5 +1,5 @@ name: diagrams-rasterific-version: 1.4+version: 1.4.1 synopsis: Rasterific backend for diagrams. description: A full-featured backend for rendering diagrams using the Rasterific rendering engine.@@ -13,8 +13,8 @@ build-type: Simple data-files: fonts/*.ttf extra-source-files: README.md, CHANGELOG.md-tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1-cabal-version: >=1.10+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.2+cabal-version: 1.18 Source-repository head type: git location: http://github.com/diagrams/diagrams-rasterific.git@@ -25,21 +25,43 @@ Diagrams.Backend.Rasterific.Text hs-source-dirs: src other-modules: Paths_diagrams_rasterific- build-depends: base >= 4.2 && < 4.10,+ build-depends: base >= 4.2 && < 4.12, diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5, hashable >= 1.1 && < 1.3, Rasterific >= 0.6.1 && < 0.8, FontyFruity >= 0.5 && < 0.6, JuicyPixels >= 3.1.5 && < 3.3,- lens >= 4.0 && < 4.16,+ lens >= 4.0 && < 4.17, mtl >= 2.1 && < 2.3, data-default-class >= 0.0 && < 0.2, containers >= 0.5 && < 0.6, filepath >= 1.2 && < 1.5,- optparse-applicative >= 0.13 && < 0.14,+ optparse-applicative >= 0.13 && < 0.15, bytestring >= 0.9 && < 0.11, file-embed >= 0.0 && < 0.1 default-language: Haskell2010 ghc-options: -Wall++test-suite test0+ type: exitcode-stdio-1.0+ main-is: test0.hs+ hs-source-dirs: test+ build-depends: base >= 4.2 && < 4.12,+ diagrams-rasterific,+ diagrams-core >= 1.4 && < 1.5,+ diagrams-lib >= 1.4 && < 1.5+ ghc-options: -Wall+ default-language: Haskell2010++test-suite test1+ type: exitcode-stdio-1.0+ main-is: test1.hs+ hs-source-dirs: test+ build-depends: base >= 4.2 && < 4.12,+ diagrams-rasterific,+ diagrams-core >= 1.4 && < 1.5,+ diagrams-lib >= 1.4 && < 1.5+ ghc-options: -Wall+ default-language: Haskell2010
src/Diagrams/Backend/Rasterific.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ExistentialQuantification #-}@@ -201,9 +203,14 @@ runR :: Render Rasterific V2 n -> RenderM n () runR (R r) = r +instance Semigroup (Render Rasterific V2 n) where+ R rd1 <> R rd2 = R (rd1 >> rd2)+ instance Monoid (Render Rasterific V2 n) where mempty = R $ return ()- R rd1 `mappend` R rd2 = R (rd1 >> rd2)+#if !MIN_VERSION_base(4,11,0)+ mappend = (<>)+#endif instance Hashable n => Hashable (Options Rasterific V2 n) where hashWithSalt s (RasterificOptions sz) = s `hashWithSalt` sz@@ -332,8 +339,8 @@ mkStroke :: TypeableFloat n => n -> R.Join -> (R.Cap, R.Cap) -> Maybe (R.DashPattern, n) -> [[R.Primitive]] -> RenderR () mkStroke (realToFrac -> l) j c d primList =- maybe (mapM_ (R.stroke l j c) primList)- (\(dsh, off) -> mapM_ (R.dashedStrokeWithOffset (realToFrac off) dsh l j c) primList)+ maybe (R.stroke l j c $ concat primList)+ (\(dsh, off) -> R.dashedStrokeWithOffset (realToFrac off) dsh l j c $ concat primList) d instance TypeableFloat n => Renderable (Path V2 n) Rasterific where
src/Diagrams/Backend/Rasterific/CmdLine.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-}
src/Diagrams/Backend/Rasterific/Text.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-}
+ test/test0.hs view
@@ -0,0 +1,14 @@+import Diagrams.Prelude+import Diagrams.Backend.Rasterific++dia :: Diagram B+dia = circle 35 # fc red+ <> regPoly 16 200 # fc blue+ <> regPoly 5 400 # fc orange # rotateBy (1/6)++sizeSpec :: SizeSpec V2 Double+sizeSpec = mkSizeSpec2D (Just 600) Nothing++main :: IO ()+main = renderRasterific "test0.png" sizeSpec dia+ --(dia # translateX 0 # translateY (-300))
+ test/test1.hs view
@@ -0,0 +1,20 @@+import Diagrams.Prelude+import Diagrams.Backend.Rasterific++dia :: Diagram B+dia = bgFrame 1 white $+ vsep 0.5+ [ l # lw thick+ , l # lw thin+ , l # lwG 0+ ]+ where+ l = stroke (straight unitX `at` origin)++sizeSpec :: SizeSpec V2 Double+sizeSpec = mkSizeSpec2D (Just 600) Nothing++main :: IO ()+main = do+ renderRasterific "test1.png" sizeSpec dia+ renderRasterific "test1.pdf" sizeSpec dia