diagrams-svg 1.4.0.1 → 1.4.0.2
raw patch · 4 files changed
+29/−22 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Diagrams.Backend.SVG: instance (Data.Hashable.Class.Hashable n, Graphics.Rendering.SVG.SVGFloat n) => Data.Hashable.Class.Hashable (Diagrams.Core.Types.Options Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
- Diagrams.Backend.SVG: instance Graphics.Rendering.SVG.SVGFloat n => GHC.Base.Monoid (Diagrams.Core.Types.Render Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
+ Diagrams.Backend.SVG: instance Data.Hashable.Class.Hashable n => Data.Hashable.Class.Hashable (Diagrams.Core.Types.Options Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
+ Diagrams.Backend.SVG: instance GHC.Base.Monoid (Diagrams.Core.Types.Render Diagrams.Backend.SVG.SVG Linear.V2.V2 n)
- Diagrams.Backend.SVG: generateDoctype :: SVGFloat n => Lens' (Options SVG V2 n) Bool
+ Diagrams.Backend.SVG: generateDoctype :: Lens' (Options SVG V2 n) Bool
- Diagrams.Backend.SVG: idPrefix :: SVGFloat n => Lens' (Options SVG V2 n) Text
+ Diagrams.Backend.SVG: idPrefix :: Lens' (Options SVG V2 n) Text
- Diagrams.Backend.SVG: sizeSpec :: SVGFloat n => Lens' (Options SVG V2 n) (SizeSpec V2 n)
+ Diagrams.Backend.SVG: sizeSpec :: Lens' (Options SVG V2 n) (SizeSpec V2 n)
- Diagrams.Backend.SVG: svgAttributes :: SVGFloat n => Lens' (Options SVG V2 n) [Attribute]
+ Diagrams.Backend.SVG: svgAttributes :: Lens' (Options SVG V2 n) [Attribute]
- Diagrams.Backend.SVG: svgDefinitions :: SVGFloat n => Lens' (Options SVG V2 n) (Maybe Element)
+ Diagrams.Backend.SVG: svgDefinitions :: Lens' (Options SVG V2 n) (Maybe Element)
Files
- CHANGELOG.md +6/−0
- diagrams-svg.cabal +1/−1
- src/Diagrams/Backend/SVG.hs +13/−13
- src/Graphics/Rendering/SVG.hs +9/−8
CHANGELOG.md view
@@ -1,3 +1,9 @@+## [v1.4.0.2](https://github.com/diagrams/diagrams-svg/tree/v1.4.0.2) (2016-06-06)++- allow `base-4.9`+- test with GHC 8.0+- minor documentation updates+ ## [v1.4.0.1](https://github.com/diagrams/diagrams-svg/tree/v1.4.0.1) (2016-05-01) - allow `lens-4.14`
diagrams-svg.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-svg-Version: 1.4.0.1+Version: 1.4.0.2 Synopsis: SVG backend for diagrams drawing EDSL. Homepage: http://projects.haskell.org/diagrams/ License: BSD3
src/Diagrams/Backend/SVG.hs view
@@ -89,9 +89,9 @@ -- situations GHC may not be able to infer the type @m@, in which case -- you can use a type annotation to specify it; it may be useful to -- simply use the type synonym @Diagram SVG = QDiagram SVG V2 Double--- Any@.) This returns an 'Graphics.Rendering.SVG.Element' value, which--- you can, /e.g./ render to a 'ByteString' using 'Lucid.Svg.renderBS'--- from the 'lucid-svg' package.+-- Any@.) This returns an 'Graphics.Svg.Core.Element' value, which+-- you can, /e.g./ render to a 'ByteString' using 'Graphics.Svg.Core.renderBS'+-- from the 'svg-builder' package. -- ----------------------------------------------------------------------------- @@ -148,11 +148,11 @@ import Diagrams.TwoD.Path (Clip (Clip)) import Diagrams.TwoD.Text --- from lucid-svg+-- from svg-builder import Graphics.Svg hiding ((<>)) -- from this package-import Graphics.Rendering.SVG (SVGFloat, Element)+import Graphics.Rendering.SVG (SVGFloat) import qualified Graphics.Rendering.SVG as R -- | @SVG@ is simply a token used to identify this rendering backend@@ -194,7 +194,7 @@ runRenderM o s = flip evalState initialSvgRenderState $ runReaderT s (initialEnvironment o) -instance SVGFloat n => Monoid (Render SVG V2 n) where+instance Monoid (Render SVG V2 n) where mempty = R $ return mempty R r1 `mappend` R r2_ = R $ do svg1 <- r1@@ -214,7 +214,7 @@ Nothing -> return svg Just paths -> renderClips paths where- renderClips :: SVGFloat n => [Path V2 n] -> SvgRenderM n+ renderClips :: [Path V2 n] -> SvgRenderM n renderClips [] = return svg renderClips (p:ps) = do clipPathId += 1@@ -274,29 +274,29 @@ R r = foldMap rtree rs -- | Lens onto the size of the svg options.-sizeSpec :: SVGFloat n => Lens' (Options SVG V2 n) (SizeSpec V2 n)+sizeSpec :: Lens' (Options SVG V2 n) (SizeSpec V2 n) sizeSpec f opts = f (_size opts) <&> \s -> opts { _size = s } -- | Lens onto the svg definitions of the svg options.-svgDefinitions :: SVGFloat n => Lens' (Options SVG V2 n) (Maybe Element)+svgDefinitions :: Lens' (Options SVG V2 n) (Maybe Element) svgDefinitions f opts = f (_svgDefinitions opts) <&> \ds -> opts { _svgDefinitions = ds } -- | Lens onto the idPrefix of the svg options. This is the prefix given -- to clipping paths to distinguish them from other svg files in the -- same web page.-idPrefix :: SVGFloat n => Lens' (Options SVG V2 n) T.Text+idPrefix :: Lens' (Options SVG V2 n) T.Text idPrefix f opts = f (_idPrefix opts) <&> \i -> opts { _idPrefix = i } -- | Lens onto the svgAttributes field of the svg options. This field -- is provided to supply SVG attributes to the entire diagram.-svgAttributes :: SVGFloat n => Lens' (Options SVG V2 n) [Attribute]+svgAttributes :: Lens' (Options SVG V2 n) [Attribute] svgAttributes f opts = f (_svgAttributes opts) <&> \ds -> opts { _svgAttributes = ds } -- | Lens onto the generateDoctype field of the svg options. Set -- to False if you don't want a doctype tag included in the output.-generateDoctype :: SVGFloat n => Lens' (Options SVG V2 n) Bool+generateDoctype :: Lens' (Options SVG V2 n) Bool generateDoctype f opts = f (_generateDoctype opts) <&> \ds -> opts { _generateDoctype = ds } @@ -379,7 +379,7 @@ _ -> fail "Unknown mime type while rendering image" return $ R.renderDImage di $ R.dataUri mime d -instance (Hashable n, SVGFloat n) => Hashable (Options SVG V2 n) where+instance Hashable n => Hashable (Options SVG V2 n) where hashWithSalt s (SVGOptions sz defs ia sa gd) = s `hashWithSalt` sz `hashWithSalt`
src/Graphics/Rendering/SVG.hs view
@@ -297,15 +297,15 @@ , renderFontFamily , renderMiterLimit ] -renderMiterLimit :: SVGFloat n => Style v n -> [Attribute]+renderMiterLimit :: Style v n -> [Attribute] renderMiterLimit s = renderAttr Stroke_miterlimit_ miterLimit where miterLimit = getLineMiterLimit <$> getAttr s -renderOpacity :: SVGFloat n => Style v n -> [Attribute]+renderOpacity :: Style v n -> [Attribute] renderOpacity s = renderAttr Opacity_ o where o = getOpacity <$> getAttr s -renderFillRule :: SVGFloat n => Style v n -> [Attribute]+renderFillRule :: Style v n -> [Attribute] renderFillRule s = renderTextAttr Fill_rule_ fr where fr = (fillRuleToText . getFillRule) <$> getAttr s fillRuleToText :: FillRule -> AttributeValue@@ -316,7 +316,7 @@ renderLineWidth s = renderAttr Stroke_width_ lWidth where lWidth = getNumAttr getLineWidth s -renderLineCap :: SVGFloat n => Style v n -> [Attribute]+renderLineCap :: Style v n -> [Attribute] renderLineCap s = renderTextAttr Stroke_linecap_ lCap where lCap = (lineCapToText . getLineCap) <$> getAttr s lineCapToText :: LineCap -> AttributeValue@@ -324,7 +324,7 @@ lineCapToText LineCapRound = "round" lineCapToText LineCapSquare = "square" -renderLineJoin :: SVGFloat n => Style v n -> [Attribute]+renderLineJoin :: Style v n -> [Attribute] renderLineJoin s = renderTextAttr Stroke_linejoin_ lj where lj = (lineJoinToText . getLineJoin) <$> getAttr s lineJoinToText :: LineJoin -> AttributeValue@@ -351,7 +351,7 @@ where fs = pack <$> getNumAttr ((++ "px") . show . getFontSize) s -renderFontSlant :: SVGFloat n => Style v n -> [Attribute]+renderFontSlant :: Style v n -> [Attribute] renderFontSlant s = renderTextAttr Font_style_ fs where fs = (fontSlantAttr . getFontSlant) <$> getAttr s@@ -360,7 +360,7 @@ fontSlantAttr FontSlantOblique = "oblique" fontSlantAttr FontSlantNormal = "normal" -renderFontWeight :: SVGFloat n => Style v n -> [Attribute]+renderFontWeight :: Style v n -> [Attribute] renderFontWeight s = renderTextAttr Font_weight_ fw where fw = (fontWeightAttr . getFontWeight) <$> getAttr s@@ -368,7 +368,8 @@ fontWeightAttr FontWeightNormal = "normal" fontWeightAttr FontWeightBold = "bold" -renderFontFamily :: SVGFloat n => Style v n -> [Attribute]++renderFontFamily :: Style v n -> [Attribute] renderFontFamily s = renderTextAttr Font_family_ ff where ff = (pack . getFont) <$> getAttr s