diagrams-pgf 1.5.0.1 → 1.5.0.2
raw patch · 5 files changed
+26/−29 lines, 5 filesdep −bytestring-builderdep −colourdep −processdep ~basedep ~containersdep ~diagrams-libPVP ok
version bump matches the API change (PVP)
Dependencies removed: bytestring-builder, colour, process, split
Dependency ranges changed: base, containers, diagrams-lib, texrunner
API changes (from Hackage documentation)
Files
- diagrams-pgf.cabal +7/−11
- src/Diagrams/Backend/PGF/Hbox.hs +0/−1
- src/Diagrams/Backend/PGF/Render.hs +1/−2
- src/Diagrams/Backend/PGF/Surface.hs +3/−4
- src/Graphics/Rendering/PGF.hs +15/−11
diagrams-pgf.cabal view
@@ -1,10 +1,10 @@ name: diagrams-pgf-version: 1.5.0.1+version: 1.5.0.2 synopsis: PGF backend for diagrams drawing EDSL. license: BSD3 license-file: LICENSE author: Christopher Chalmers-maintainer: c.chalmers@me.com+maintainer: byorgey@gmail.com homepage: http://github.com/cchalmers/diagrams-pgf bug-reports: http://github.com/cchalmers/diagrams-pgf/issues stability: Experimental@@ -13,7 +13,7 @@ cabal-version: 1.18 extra-source-files: README.md, diagrams/*.svg extra-doc-files: diagrams/*.svg-tested-with: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.5 || ==9.8.2 || ==9.10.1 || ==9.12.1+tested-with: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.4 || ==9.14.1 description: This package provides a modular backend for rendering diagrams created@@ -34,21 +34,17 @@ Graphics.Rendering.PGF hs-source-dirs: src build-depends:- base >= 4.4 && < 4.22,+ base >= 4.4 && < 4.23, bytestring >= 0.9 && < 1.1,- bytestring-builder < 1.1,- containers >= 0.3 && < 0.8,- colour,+ containers >= 0.3 && < 0.9, diagrams-core >= 1.4 && < 1.6,- diagrams-lib >= 1.4 && < 1.6,+ diagrams-lib >= 1.4 && < 1.7, directory >= 1.0 && < 1.4, filepath >= 1.2 && < 1.6, hashable >= 1.1 && < 1.6, mtl >= 2.1 && < 3.0, optparse-applicative >= 0.13 && < 0.20,- process >= 1.0 && < 1.7,- split >= 0.1.2 && < 0.3,- texrunner <= 0.0.2,+ texrunner <= 0.0.3, JuicyPixels, vector, zlib
src/Diagrams/Backend/PGF/Hbox.hs view
@@ -53,7 +53,6 @@ -- | Primitive for placing raw Tex commands in a hbox. data Hbox n = Hbox (Transformation V2 n) String- deriving Typeable type instance V (Hbox n) = V2 type instance N (Hbox n) = n
src/Diagrams/Backend/PGF/Render.hs view
@@ -43,7 +43,6 @@ import Diagrams.Core.Types import Diagrams.Prelude hiding ((<~)) -import Data.Typeable import Diagrams.Backend.PGF.Hbox (Hbox (..)) import Diagrams.Backend.PGF.Surface (Surface) import Diagrams.TwoD.Adjust (adjustDia2D)@@ -58,7 +57,7 @@ -- | This data declaration is simply used as a token to distinguish -- this rendering engine. data PGF = PGF- deriving (Show, Typeable)+ deriving (Show) type instance V PGF = V2 type instance N PGF = Double
src/Diagrams/Backend/PGF/Surface.hs view
@@ -45,7 +45,6 @@ import Data.ByteString.Builder import Data.Hashable (Hashable (..))-import Data.Typeable (Typeable) import System.IO.Unsafe import System.Texrunner.Online @@ -56,7 +55,7 @@ -- | The 'TexFormat' is used to choose the different PGF commands necessary for -- that format. data TexFormat = LaTeX | ConTeXt | PlainTeX- deriving (Show, Read, Eq, Typeable)+ deriving (Show, Read, Eq) -- These names are only capitalised so Context doesn't conflict with -- lens's Context. @@ -289,13 +288,13 @@ hashWithSalt s PlainTeX = s `hashWithSalt` (3::Int) instance Eq Surface where- Surface tf1 cm1 ar1 ps1 p1 bd1 ed1 == Surface tf2 cm2 ar2 ps2 p2 bd2 ed2+ Surface tf1 cm1 ar1 ps1 pr1 bd1 ed1 == Surface tf2 cm2 ar2 ps2 pr2 bd2 ed2 = and [ tf1 == tf2 , cm1 == cm2 , ar1 == ar2 , (ps1 <*> Just (V2 1 2)) == (ps2 <*> Just (V2 1 2))- , p1 == p2+ , pr1 == pr2 , bd1 == bd2 , ed1 == ed2 ]
src/Graphics/Rendering/PGF.hs view
@@ -102,7 +102,8 @@ import qualified Data.ByteString.Lazy as LB import qualified Data.Foldable as F (foldMap) import Data.List (intersperse)-import Data.Maybe (catMaybes)+import qualified Data.List.NonEmpty as NE+import Data.Maybe (catMaybes, fromMaybe) import Data.Typeable import qualified Data.Vector.Storable as S import Numeric@@ -414,7 +415,7 @@ curveTo :: RealFloat n => V2 n -> V2 n -> V2 n -> Render n curveTo v2 v3 v4 = ln $ do p <- use pos- let [v2',v3',v4'] = map (p .+^) [v2,v3,v4]+ let (v2',v3',v4') = over each (p .+^) (v2,v3,v4) pos .= v4' pgf "pathqcurveto" mapM_ bracerPoint [v2', v3', v4']@@ -561,9 +562,11 @@ -- transformations ----------------------------------------------------- getMatrix :: Num n => Transformation V2 n -> (n, n, n, n, n, n)-getMatrix t = (a1,a2,b1,b2,c1,c2)+getMatrix t = coeffs where- [a1, a2, b1, b2, c1, c2] = concat $ matrixHomRep t+ coeffs = case concat $ matrixHomRep t of+ [a1, a2, b1, b2, c1, c2] -> (a1,a2,b1,b2,c1,c2)+ _ -> (0,0,0,0,0,0) -- \pgftransformcm{⟨a⟩}{⟨b⟩}{⟨c⟩}{⟨d⟩}{⟨pointa} @@ -649,8 +652,8 @@ -- gradient fit to it. Then when we transform the gradient we know -- it'll fit the path. p' = transform (inv t) pth- Just (x0,x1) = extentX p'- Just (y0,y1) = extentY p'+ (x0,x1) = fromMaybe (0,1) $ extentX p'+ (y0,y1) = fromMaybe (0,1) $ extentY p' -- Final transform to fit the gradient to the path. The origin on -- the gradient is its centre so we translate by - V2 50 50 to get@@ -732,7 +735,8 @@ calcRadialStops :: RealFloat n => Path V2 n -> RGradient n -> ([GradientStop n], T2 n, P2 n) calcRadialStops (Path []) _ = ([], mempty, origin)-calcRadialStops pth (RGradient stops p0 r0 p1 r1 gt _sm)+calcRadialStops _ (RGradient [] _ _ _ _ _ _) = ([], mempty, origin)+calcRadialStops pth (RGradient (stop : stops) p0 r0 p1 r1 gt _sm) = (stops', t <> ft, P cv) where cv = tp0 .-. tp1@@ -748,8 +752,8 @@ -- probably incorrect) lower bound for the required radius of the -- circle to cover the path. p' = transform (inv t) pth- Just (x0,x1) = extentX p'- Just (y0,y1) = extentY p'+ (x0,x1) = fromMaybe (0,1) $ extentX p'+ (y0,y1) = fromMaybe (0,1) $ extentY p' d = 2 * max (max (abs $ x0 - x1) (abs $ y0 - y1)) (lstop ^. stopFraction) -- Adjust for gradient size having radius 100@@ -763,9 +767,9 @@ -- to be fixed. -- -- Only the GradPad spread method is supported for now.- stops' = head stops : over (each . stopFraction) refrac stops ++ [lstop & stopFraction .~ 100*d]+ stops' = stop : over (each . stopFraction) refrac (stop:stops) ++ [lstop & stopFraction .~ 100*d] refrac x = 100 * ((r0 + x * (r1 - r0)) / r1) -- start at r0, end at r1- lstop = last stops+ lstop = NE.last (stop NE.:| stops) -- Dirty adjustments for spread methods (PGF doesn't seem to have them). -- adjustStops :: RealFloat n => [GradientStop n] -> SpreadMethod -> [GradientStop n]