reanimate-svg 0.9.0.2 → 0.9.1.0
raw patch · 2 files changed
+17/−9 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.SvgTree.Types: attrClass :: HasDrawAttributes c_aplY => Lens' c_aplY [Text]
+ Graphics.SvgTree.Types: attrClass :: HasDrawAttributes c_apMp => Lens' c_apMp [Text]
- Graphics.SvgTree.Types: attrId :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe String)
+ Graphics.SvgTree.Types: attrId :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe String)
- Graphics.SvgTree.Types: class HasColorMatrix c_aypL
+ Graphics.SvgTree.Types: class HasColorMatrix c_ayQB
- Graphics.SvgTree.Types: class HasComposite c_aygu
+ Graphics.SvgTree.Types: class HasComposite c_ayHk
- Graphics.SvgTree.Types: class HasDocument c_axsw
+ Graphics.SvgTree.Types: class HasDocument c_axTn
- Graphics.SvgTree.Types: class HasDrawAttributes c_aplY
+ Graphics.SvgTree.Types: class HasDrawAttributes c_apMp
- Graphics.SvgTree.Types: class HasGaussianBlur c_ayuY
+ Graphics.SvgTree.Types: class HasGaussianBlur c_ayVO
- Graphics.SvgTree.Types: class HasTextPath c_ay4E
+ Graphics.SvgTree.Types: class HasTextPath c_ayvu
- Graphics.SvgTree.Types: clipPathRef :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: clipPathRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: clipRule :: HasDrawAttributes c_aplY => Lens' c_aplY (Last FillRule)
+ Graphics.SvgTree.Types: clipRule :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FillRule)
- Graphics.SvgTree.Types: colorMatrix :: HasColorMatrix c_aypL => Lens' c_aypL ColorMatrix
+ Graphics.SvgTree.Types: colorMatrix :: HasColorMatrix c_ayQB => Lens' c_ayQB ColorMatrix
- Graphics.SvgTree.Types: colorMatrixDrawAttributes :: HasColorMatrix c_aypL => Lens' c_aypL DrawAttributes
+ Graphics.SvgTree.Types: colorMatrixDrawAttributes :: HasColorMatrix c_ayQB => Lens' c_ayQB DrawAttributes
- Graphics.SvgTree.Types: colorMatrixFilterAttr :: HasColorMatrix c_aypL => Lens' c_aypL FilterAttributes
+ Graphics.SvgTree.Types: colorMatrixFilterAttr :: HasColorMatrix c_ayQB => Lens' c_ayQB FilterAttributes
- Graphics.SvgTree.Types: colorMatrixIn :: HasColorMatrix c_aypL => Lens' c_aypL (Last FilterSource)
+ Graphics.SvgTree.Types: colorMatrixIn :: HasColorMatrix c_ayQB => Lens' c_ayQB (Last FilterSource)
- Graphics.SvgTree.Types: colorMatrixType :: HasColorMatrix c_aypL => Lens' c_aypL ColorMatrixType
+ Graphics.SvgTree.Types: colorMatrixType :: HasColorMatrix c_ayQB => Lens' c_ayQB ColorMatrixType
- Graphics.SvgTree.Types: colorMatrixValues :: HasColorMatrix c_aypL => Lens' c_aypL String
+ Graphics.SvgTree.Types: colorMatrixValues :: HasColorMatrix c_ayQB => Lens' c_ayQB String
- Graphics.SvgTree.Types: composite :: HasComposite c_aygu => Lens' c_aygu Composite
+ Graphics.SvgTree.Types: composite :: HasComposite c_ayHk => Lens' c_ayHk Composite
- Graphics.SvgTree.Types: compositeDrawAttributes :: HasComposite c_aygu => Lens' c_aygu DrawAttributes
+ Graphics.SvgTree.Types: compositeDrawAttributes :: HasComposite c_ayHk => Lens' c_ayHk DrawAttributes
- Graphics.SvgTree.Types: compositeFilterAttr :: HasComposite c_aygu => Lens' c_aygu FilterAttributes
+ Graphics.SvgTree.Types: compositeFilterAttr :: HasComposite c_ayHk => Lens' c_ayHk FilterAttributes
- Graphics.SvgTree.Types: compositeIn :: HasComposite c_aygu => Lens' c_aygu (Last FilterSource)
+ Graphics.SvgTree.Types: compositeIn :: HasComposite c_ayHk => Lens' c_ayHk (Last FilterSource)
- Graphics.SvgTree.Types: compositeIn2 :: HasComposite c_aygu => Lens' c_aygu (Last FilterSource)
+ Graphics.SvgTree.Types: compositeIn2 :: HasComposite c_ayHk => Lens' c_ayHk (Last FilterSource)
- Graphics.SvgTree.Types: compositeK1 :: HasComposite c_aygu => Lens' c_aygu Number
+ Graphics.SvgTree.Types: compositeK1 :: HasComposite c_ayHk => Lens' c_ayHk Number
- Graphics.SvgTree.Types: compositeK2 :: HasComposite c_aygu => Lens' c_aygu Number
+ Graphics.SvgTree.Types: compositeK2 :: HasComposite c_ayHk => Lens' c_ayHk Number
- Graphics.SvgTree.Types: compositeK3 :: HasComposite c_aygu => Lens' c_aygu Number
+ Graphics.SvgTree.Types: compositeK3 :: HasComposite c_ayHk => Lens' c_ayHk Number
- Graphics.SvgTree.Types: compositeK4 :: HasComposite c_aygu => Lens' c_aygu Number
+ Graphics.SvgTree.Types: compositeK4 :: HasComposite c_ayHk => Lens' c_ayHk Number
- Graphics.SvgTree.Types: compositeOperator :: HasComposite c_aygu => Lens' c_aygu CompositeOperator
+ Graphics.SvgTree.Types: compositeOperator :: HasComposite c_ayHk => Lens' c_ayHk CompositeOperator
- Graphics.SvgTree.Types: definitions :: HasDocument c_axsw => Lens' c_axsw (Map String Tree)
+ Graphics.SvgTree.Types: definitions :: HasDocument c_axTn => Lens' c_axTn (Map String Tree)
- Graphics.SvgTree.Types: description :: HasDocument c_axsw => Lens' c_axsw String
+ Graphics.SvgTree.Types: description :: HasDocument c_axTn => Lens' c_axTn String
- Graphics.SvgTree.Types: document :: HasDocument c_axsw => Lens' c_axsw Document
+ Graphics.SvgTree.Types: document :: HasDocument c_axTn => Lens' c_axTn Document
- Graphics.SvgTree.Types: documentLocation :: HasDocument c_axsw => Lens' c_axsw FilePath
+ Graphics.SvgTree.Types: documentLocation :: HasDocument c_axTn => Lens' c_axTn FilePath
- Graphics.SvgTree.Types: drawAttributes :: HasDrawAttributes c_aplY => Lens' c_aplY DrawAttributes
+ Graphics.SvgTree.Types: drawAttributes :: HasDrawAttributes c_apMp => Lens' c_apMp DrawAttributes
- Graphics.SvgTree.Types: elements :: HasDocument c_axsw => Lens' c_axsw [Tree]
+ Graphics.SvgTree.Types: elements :: HasDocument c_axTn => Lens' c_axTn [Tree]
- Graphics.SvgTree.Types: fillColor :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Texture)
+ Graphics.SvgTree.Types: fillColor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Texture)
- Graphics.SvgTree.Types: fillOpacity :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe Float)
+ Graphics.SvgTree.Types: fillOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
- Graphics.SvgTree.Types: fillRule :: HasDrawAttributes c_aplY => Lens' c_aplY (Last FillRule)
+ Graphics.SvgTree.Types: fillRule :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FillRule)
- Graphics.SvgTree.Types: filterRef :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: filterRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: fontFamily :: HasDrawAttributes c_aplY => Lens' c_aplY (Last [String])
+ Graphics.SvgTree.Types: fontFamily :: HasDrawAttributes c_apMp => Lens' c_apMp (Last [String])
- Graphics.SvgTree.Types: fontSize :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Number)
+ Graphics.SvgTree.Types: fontSize :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
- Graphics.SvgTree.Types: fontStyle :: HasDrawAttributes c_aplY => Lens' c_aplY (Last FontStyle)
+ Graphics.SvgTree.Types: fontStyle :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FontStyle)
- Graphics.SvgTree.Types: gaussianBlur :: HasGaussianBlur c_ayuY => Lens' c_ayuY GaussianBlur
+ Graphics.SvgTree.Types: gaussianBlur :: HasGaussianBlur c_ayVO => Lens' c_ayVO GaussianBlur
- Graphics.SvgTree.Types: gaussianBlurDrawAttributes :: HasGaussianBlur c_ayuY => Lens' c_ayuY DrawAttributes
+ Graphics.SvgTree.Types: gaussianBlurDrawAttributes :: HasGaussianBlur c_ayVO => Lens' c_ayVO DrawAttributes
- Graphics.SvgTree.Types: gaussianBlurEdgeMode :: HasGaussianBlur c_ayuY => Lens' c_ayuY EdgeMode
+ Graphics.SvgTree.Types: gaussianBlurEdgeMode :: HasGaussianBlur c_ayVO => Lens' c_ayVO EdgeMode
- Graphics.SvgTree.Types: gaussianBlurFilterAttr :: HasGaussianBlur c_ayuY => Lens' c_ayuY FilterAttributes
+ Graphics.SvgTree.Types: gaussianBlurFilterAttr :: HasGaussianBlur c_ayVO => Lens' c_ayVO FilterAttributes
- Graphics.SvgTree.Types: gaussianBlurIn :: HasGaussianBlur c_ayuY => Lens' c_ayuY (Last FilterSource)
+ Graphics.SvgTree.Types: gaussianBlurIn :: HasGaussianBlur c_ayVO => Lens' c_ayVO (Last FilterSource)
- Graphics.SvgTree.Types: gaussianBlurStdDeviationX :: HasGaussianBlur c_ayuY => Lens' c_ayuY Number
+ Graphics.SvgTree.Types: gaussianBlurStdDeviationX :: HasGaussianBlur c_ayVO => Lens' c_ayVO Number
- Graphics.SvgTree.Types: gaussianBlurStdDeviationY :: HasGaussianBlur c_ayuY => Lens' c_ayuY (Last Number)
+ Graphics.SvgTree.Types: gaussianBlurStdDeviationY :: HasGaussianBlur c_ayVO => Lens' c_ayVO (Last Number)
- Graphics.SvgTree.Types: groupOpacity :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe Float)
+ Graphics.SvgTree.Types: groupOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
- Graphics.SvgTree.Types: height :: HasDocument c_axsw => Lens' c_axsw (Maybe Number)
+ Graphics.SvgTree.Types: height :: HasDocument c_axTn => Lens' c_axTn (Maybe Number)
- Graphics.SvgTree.Types: markerEnd :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: markerEnd :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: markerMid :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: markerMid :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: markerStart :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: markerStart :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: maskRef :: HasDrawAttributes c_aplY => Lens' c_aplY (Last ElementRef)
+ Graphics.SvgTree.Types: maskRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
- Graphics.SvgTree.Types: preRendered :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe String)
+ Graphics.SvgTree.Types: preRendered :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe String)
- Graphics.SvgTree.Types: strokeColor :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Texture)
+ Graphics.SvgTree.Types: strokeColor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Texture)
- Graphics.SvgTree.Types: strokeDashArray :: HasDrawAttributes c_aplY => Lens' c_aplY (Last [Number])
+ Graphics.SvgTree.Types: strokeDashArray :: HasDrawAttributes c_apMp => Lens' c_apMp (Last [Number])
- Graphics.SvgTree.Types: strokeLineCap :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Cap)
+ Graphics.SvgTree.Types: strokeLineCap :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Cap)
- Graphics.SvgTree.Types: strokeLineJoin :: HasDrawAttributes c_aplY => Lens' c_aplY (Last LineJoin)
+ Graphics.SvgTree.Types: strokeLineJoin :: HasDrawAttributes c_apMp => Lens' c_apMp (Last LineJoin)
- Graphics.SvgTree.Types: strokeMiterLimit :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Double)
+ Graphics.SvgTree.Types: strokeMiterLimit :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Double)
- Graphics.SvgTree.Types: strokeOffset :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Number)
+ Graphics.SvgTree.Types: strokeOffset :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
- Graphics.SvgTree.Types: strokeOpacity :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe Float)
+ Graphics.SvgTree.Types: strokeOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
- Graphics.SvgTree.Types: strokeWidth :: HasDrawAttributes c_aplY => Lens' c_aplY (Last Number)
+ Graphics.SvgTree.Types: strokeWidth :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
- Graphics.SvgTree.Types: textAnchor :: HasDrawAttributes c_aplY => Lens' c_aplY (Last TextAnchor)
+ Graphics.SvgTree.Types: textAnchor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last TextAnchor)
- Graphics.SvgTree.Types: textPath :: HasTextPath c_ay4E => Lens' c_ay4E TextPath
+ Graphics.SvgTree.Types: textPath :: HasTextPath c_ayvu => Lens' c_ayvu TextPath
- Graphics.SvgTree.Types: textPathMethod :: HasTextPath c_ay4E => Lens' c_ay4E TextPathMethod
+ Graphics.SvgTree.Types: textPathMethod :: HasTextPath c_ayvu => Lens' c_ayvu TextPathMethod
- Graphics.SvgTree.Types: textPathName :: HasTextPath c_ay4E => Lens' c_ay4E String
+ Graphics.SvgTree.Types: textPathName :: HasTextPath c_ayvu => Lens' c_ayvu String
- Graphics.SvgTree.Types: textPathSpacing :: HasTextPath c_ay4E => Lens' c_ay4E TextPathSpacing
+ Graphics.SvgTree.Types: textPathSpacing :: HasTextPath c_ayvu => Lens' c_ayvu TextPathSpacing
- Graphics.SvgTree.Types: textPathStartOffset :: HasTextPath c_ay4E => Lens' c_ay4E Number
+ Graphics.SvgTree.Types: textPathStartOffset :: HasTextPath c_ayvu => Lens' c_ayvu Number
- Graphics.SvgTree.Types: transform :: HasDrawAttributes c_aplY => Lens' c_aplY (Maybe [Transformation])
+ Graphics.SvgTree.Types: transform :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe [Transformation])
- Graphics.SvgTree.Types: viewBox :: HasDocument c_axsw => Lens' c_axsw (Maybe (Double, Double, Double, Double))
+ Graphics.SvgTree.Types: viewBox :: HasDocument c_axTn => Lens' c_axTn (Maybe (Double, Double, Double, Double))
- Graphics.SvgTree.Types: width :: HasDocument c_axsw => Lens' c_axsw (Maybe Number)
+ Graphics.SvgTree.Types: width :: HasDocument c_axTn => Lens' c_axTn (Maybe Number)
Files
- reanimate-svg.cabal +1/−1
- src/Graphics/SvgTree/CssTypes.hs +16/−8
reanimate-svg.cabal view
@@ -1,5 +1,5 @@ name: reanimate-svg-version: 0.9.0.2+version: 0.9.1.0 synopsis: SVG file loader and serializer description: reanimate-svg provides types representing a SVG document,
src/Graphics/SvgTree/CssTypes.hs view
@@ -29,6 +29,7 @@ import qualified Data.Text as T import qualified Data.Text.Lazy.Builder as TB import Text.Printf+import Data.Ratio import Codec.Picture (PixelRGBA8 (..)) @@ -208,19 +209,26 @@ Point n -> Point $ f n Inches n -> Inches $ f n +-- XXX: Compress unused precision. -- | Encode the number to string which can be used in a -- CSS or a svg attributes. serializeNumber :: Number -> String serializeNumber n = case n of- Num c -> printf "%g" c- Px c -> printf "%gpx" c- Em cc -> printf "%gem" cc+ Num c -> ppDouble c+ Px c -> printf "%.*gpx" precision c+ Em cc -> printf "%.*gem" precision cc Percent p -> printf "%d%%" (floor $ 100 * p :: Int)- Pc p -> printf "%gpc" p- Mm m -> printf "%gmm" m- Cm c -> printf "%gcm" c- Point p -> printf "%gpt" p- Inches i -> printf "%gin" i+ Pc p -> printf "%.*gpc" precision p+ Mm m -> printf "%.*gmm" precision m+ Cm c -> printf "%.*gcm" precision c+ Point p -> printf "%.*gpt" precision p+ Inches i -> printf "%.*gin" precision i+ where+ ppDouble d = pickMin+ (printf "%.*g" precision d)+ (printf "%g" d)+ pickMin a b = if length a < length b then a else b+ precision = 6 :: Int instance TextBuildable Number where tserialize = TB.fromText . T.pack . serializeNumber