diagrams-rasterific 1.4.1.1 → 1.4.2
raw patch · 3 files changed
+43/−13 lines, 3 filesdep ~basedep ~hashabledep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, hashable, lens, optparse-applicative
API changes (from Hackage documentation)
+ Diagrams.Backend.Rasterific: data family Options b (v :: Type -> Type) n :: Type
+ Diagrams.Backend.Rasterific: renderPdfBS :: TypeableFloat n => Int -> Int -> SizeSpec V2 n -> QDiagram Rasterific V2 n Any -> ByteString
+ Diagrams.Backend.Rasterific: renderPdfBSWithDPI :: TypeableFloat n => Int -> Int -> Dpi -> SizeSpec V2 n -> QDiagram Rasterific V2 n Any -> ByteString
Files
- CHANGELOG.md +7/−0
- diagrams-rasterific.cabal +10/−11
- src/Diagrams/Backend/Rasterific.hs +26/−2
CHANGELOG.md view
@@ -1,3 +1,10 @@+## [v1.4.2](https://github.com/diagrams/diagrams-rasterific/tree/v1.4.2) (2019-12-09)++ - Add `renderPdfBS` function to output PDF in-memory.+ - Add `renderPdfBSWithDPI` to allow additionally specifying the DPI.+ - Bug fix: include fonts in `extra-source-files` rather than+ `data-files`.+ ## [v1.4.1.1](https://github.com/diagrams/diagrams-rasterific/tree/v1.4.1.1) (2018-10-12) - Require `Rasterific-0.7.4` to
diagrams-rasterific.cabal view
@@ -1,5 +1,5 @@ name: diagrams-rasterific-version: 1.4.1.1+version: 1.4.2 synopsis: Rasterific backend for diagrams. description: A full-featured backend for rendering diagrams using the Rasterific rendering engine.@@ -11,9 +11,8 @@ bug-reports: http://github.com/diagrams/diagrams-rasterific/issues category: Graphics build-type: Simple-data-files: fonts/*.ttf-extra-source-files: README.md, CHANGELOG.md-tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1+extra-source-files: README.md, CHANGELOG.md, fonts/*.ttf+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.3 || ==8.6.5 || ==8.8.1 cabal-version: 1.18 Source-repository head type: git@@ -25,19 +24,19 @@ Diagrams.Backend.Rasterific.Text hs-source-dirs: src other-modules: Paths_diagrams_rasterific- build-depends: base >= 4.2 && < 4.13,+ build-depends: base >= 4.2 && < 4.14, diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5,- hashable >= 1.1 && < 1.3,+ hashable >= 1.1 && < 1.4, Rasterific >= 0.7.4 && < 0.8, FontyFruity >= 0.5 && < 0.6, JuicyPixels >= 3.1.5 && < 3.4,- lens >= 4.0 && < 4.18,+ lens >= 4.0 && < 4.19, mtl >= 2.1 && < 2.3, data-default-class >= 0.0 && < 0.2, containers >= 0.5 && < 0.7, filepath >= 1.2 && < 1.5,- optparse-applicative >= 0.13 && < 0.15,+ optparse-applicative >= 0.13 && < 0.16, bytestring >= 0.9 && < 0.11, file-embed >= 0.0 && < 0.1 @@ -48,7 +47,7 @@ type: exitcode-stdio-1.0 main-is: test-render.hs hs-source-dirs: test- build-depends: base >= 4.2 && < 4.13,+ build-depends: base >= 4.2 && < 4.14, diagrams-rasterific, diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5@@ -59,7 +58,7 @@ type: exitcode-stdio-1.0 main-is: test-widths.hs hs-source-dirs: test- build-depends: base >= 4.2 && < 4.13,+ build-depends: base >= 4.2 && < 4.14, diagrams-rasterific, diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5@@ -70,7 +69,7 @@ type: exitcode-stdio-1.0 main-is: test-size.hs hs-source-dirs: test- build-depends: base >= 4.2 && < 4.13,+ build-depends: base >= 4.2 && < 4.14, diagrams-rasterific, diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5
src/Diagrams/Backend/Rasterific.hs view
@@ -78,6 +78,8 @@ -- * Rendering , renderRasterific , renderPdf+ , renderPdfBS+ , renderPdfBSWithDPI , size , writeJpeg@@ -125,6 +127,7 @@ withSampler) import qualified Graphics.Rasterific.Transformations as R+import Graphics.Text.TrueType (Dpi) import Control.Monad.Reader import Diagrams.Backend.Rasterific.Text@@ -416,13 +419,34 @@ where bs = encodeJpegAtQuality quality (pixelMap (convertPixel . dropTransparency) img) ++-- | Render a 'Rasterific' diagram to a pdf bytestring with given width,+-- height, & DPI.+renderPdfBSWithDPI+ :: TypeableFloat n+ => Int+ -> Int+ -> Dpi+ -> SizeSpec V2 n+ -> QDiagram Rasterific V2 n Any+ -> ByteString+renderPdfBSWithDPI w h dpi spec d = bs+ where+ bs = R.renderDrawingAtDpiToPDF w h dpi (runRenderM . runR $ fromRTree rtree)+ rtree = rTree spec d++-- | Render a 'Rasterific' diagram to a pdf bytestring with given width and height+renderPdfBS :: TypeableFloat n => Int -> Int -> SizeSpec V2 n+ -> QDiagram Rasterific V2 n Any -> ByteString+renderPdfBS w h =+ renderPdfBSWithDPI w h 96+ -- | Render a 'Rasterific' diagram to a pdf file with given width and height renderPdf :: TypeableFloat n => Int -> Int -> FilePath -> SizeSpec V2 n -> QDiagram Rasterific V2 n Any -> IO () renderPdf w h outFile spec d = L.writeFile outFile bs where- bs = R.renderDrawingAtDpiToPDF w h 96 (runRenderM . runR . fromRTree $ rtree)- rtree = rTree spec d+ bs = renderPdfBS w h spec d rTree :: TypeableFloat n => SizeSpec V2 n -> QDiagram Rasterific V2 n Any -> RTree Rasterific V2 n Annotation