lucid-svg 0.4.0.4 → 0.5.0.0
raw patch · 3 files changed
+37/−33 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Lucid.Svg.Path: aA :: Show a => a -> a -> a -> a -> a -> a -> a -> Text
+ Lucid.Svg.Path: aA :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
- Lucid.Svg.Path: aR :: Show a => a -> a -> a -> a -> a -> a -> a -> Text
+ Lucid.Svg.Path: aR :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
- Lucid.Svg.Path: cA :: Show a => a -> a -> a -> a -> a -> a -> Text
+ Lucid.Svg.Path: cA :: RealFloat a => a -> a -> a -> a -> a -> a -> Text
- Lucid.Svg.Path: cR :: Show a => a -> a -> a -> a -> a -> a -> Text
+ Lucid.Svg.Path: cR :: RealFloat a => a -> a -> a -> a -> a -> a -> Text
- Lucid.Svg.Path: hA :: Show a => a -> Text
+ Lucid.Svg.Path: hA :: RealFloat a => a -> Text
- Lucid.Svg.Path: hR :: Show a => a -> Text
+ Lucid.Svg.Path: hR :: RealFloat a => a -> Text
- Lucid.Svg.Path: lA :: Show a => a -> a -> Text
+ Lucid.Svg.Path: lA :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: lR :: Show a => a -> a -> Text
+ Lucid.Svg.Path: lR :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: mA :: Show a => a -> a -> Text
+ Lucid.Svg.Path: mA :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: mR :: Show a => a -> a -> Text
+ Lucid.Svg.Path: mR :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: matrix :: Show a => a -> a -> a -> a -> a -> a -> Text
+ Lucid.Svg.Path: matrix :: RealFloat a => a -> a -> a -> a -> a -> a -> Text
- Lucid.Svg.Path: qA :: Show a => a -> a -> a -> a -> Text
+ Lucid.Svg.Path: qA :: RealFloat a => a -> a -> a -> a -> Text
- Lucid.Svg.Path: qR :: Show a => a -> a -> a -> a -> Text
+ Lucid.Svg.Path: qR :: RealFloat a => a -> a -> a -> a -> Text
- Lucid.Svg.Path: rotate :: Show a => a -> Text
+ Lucid.Svg.Path: rotate :: RealFloat a => a -> Text
- Lucid.Svg.Path: rotateAround :: Show a => a -> a -> a -> Text
+ Lucid.Svg.Path: rotateAround :: RealFloat a => a -> a -> a -> Text
- Lucid.Svg.Path: sA :: Show a => a -> a -> a -> a -> Text
+ Lucid.Svg.Path: sA :: RealFloat a => a -> a -> a -> a -> Text
- Lucid.Svg.Path: sR :: Show a => a -> a -> a -> a -> Text
+ Lucid.Svg.Path: sR :: RealFloat a => a -> a -> a -> a -> Text
- Lucid.Svg.Path: scale :: Show a => a -> a -> Text
+ Lucid.Svg.Path: scale :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: skewX :: Show a => a -> Text
+ Lucid.Svg.Path: skewX :: RealFloat a => a -> Text
- Lucid.Svg.Path: skewY :: Show a => a -> Text
+ Lucid.Svg.Path: skewY :: RealFloat a => a -> Text
- Lucid.Svg.Path: tA :: Show a => a -> a -> Text
+ Lucid.Svg.Path: tA :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: tR :: Show a => a -> a -> Text
+ Lucid.Svg.Path: tR :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: toText :: Show a => a -> Text
+ Lucid.Svg.Path: toText :: RealFloat a => a -> Text
- Lucid.Svg.Path: translate :: Show a => a -> a -> Text
+ Lucid.Svg.Path: translate :: RealFloat a => a -> a -> Text
- Lucid.Svg.Path: vA :: Show a => a -> Text
+ Lucid.Svg.Path: vA :: RealFloat a => a -> Text
- Lucid.Svg.Path: vR :: Show a => a -> Text
+ Lucid.Svg.Path: vR :: RealFloat a => a -> Text
Files
- lucid-svg.cabal +2/−1
- src/Lucid/Svg/Attributes.hs +2/−2
- src/Lucid/Svg/Path.hs +33/−30
lucid-svg.cabal view
@@ -1,6 +1,7 @@ name: lucid-svg-version: 0.4.0.4+version: 0.5.0.0 synopsis: DSL for SVG using lucid for HTML+description: Easy to write SVG in the syle of lucid. homepage: http://github.com/jeffreyrosenbluth/lucid-svg.git license: BSD3 license-file: LICENSE
src/Lucid/Svg/Attributes.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}- + ------------------------------------------------------------------------------- -- | -- Module : Lucid.Svg.Attributes@@ -11,7 +11,7 @@ -- ------------------------------------------------------------------------------- -module Lucid.Svg.Attributes where +module Lucid.Svg.Attributes where import Lucid.Base import Data.Text (Text)
src/Lucid/Svg/Path.hs view
@@ -15,93 +15,96 @@ module Lucid.Svg.Path where -import Data.Text (Text, pack)-import qualified Data.Text as T+import Data.Text (Text)+import qualified Data.Text as T+import Data.Text.Lazy (toStrict)+import Data.Text.Lazy.Builder (toLazyText)+import Data.Text.Lazy.Builder.RealFloat --- | Convert a showable object to Text.-toText :: Show a => a -> Text-toText = pack . show+-- | Convert a number to Text.+toText :: RealFloat a => a -> Text+toText = toStrict . toLazyText . formatRealFloat Fixed (Just 4) -- | moveto (absolute)-mA :: Show a => a -> a -> Text+mA :: RealFloat a => a -> a -> Text mA x y = T.concat ["M " ,toText x, ",", toText y, " "] -- | moveto (relative)-mR :: Show a => a -> a -> Text+mR :: RealFloat a => a -> a -> Text mR dx dy = T.concat ["m ", toText dx, ",", toText dy, " "] -- | lineto (absolute)-lA :: Show a => a -> a -> Text+lA :: RealFloat a => a -> a -> Text lA x y = T.concat ["L ", toText x, ",", toText y, " "] -- | lineto (relative)-lR :: Show a => a -> a -> Text+lR :: RealFloat a => a -> a -> Text lR dx dy = T.concat ["l ", toText dx, ",", toText dy, " "] -- | horizontal lineto (absolute)-hA :: Show a => a -> Text+hA :: RealFloat a => a -> Text hA x = T.concat ["H ", toText x, " "] -- | horizontal lineto (relative)-hR :: Show a => a -> Text+hR :: RealFloat a => a -> Text hR dx = T.concat ["h ", toText dx, " "] -- | vertical lineto (absolute)-vA :: Show a => a -> Text+vA :: RealFloat a => a -> Text vA y = T.concat ["V ", toText y, " "] -- | vertical lineto (relative)-vR :: Show a => a -> Text+vR :: RealFloat a => a -> Text vR dy = T.concat ["v ", toText dy, " "] -- | Cubic Bezier curve (absolute)-cA :: Show a => a -> a -> a -> a -> a -> a -> Text+cA :: RealFloat a => a -> a -> a -> a -> a -> a -> Text cA c1x c1y c2x c2y x y = T.concat [ "C ", toText c1x, ",", toText c1y, " ", toText c2x, "," , toText c2y, " ", toText x, " ", toText y] -- | Cubic Bezier curve (relative)-cR :: Show a => a -> a -> a -> a -> a -> a -> Text+cR :: RealFloat a => a -> a -> a -> a -> a -> a -> Text cR dc1x dc1y dc2x dc2y dx dy = T.concat [ "c ", toText dc1x, ",", toText dc1y, " ", toText dc2x , ",", toText dc2y, " ", toText dx, " ", toText dy] -- | Smooth Cubic Bezier curve (absolute)-sA :: Show a => a -> a -> a -> a -> Text+sA :: RealFloat a => a -> a -> a -> a -> Text sA c2x c2y x y = T.concat ["S ", toText c2x, ",", toText c2y, " ", toText x, ",", toText y, " "] -- | Smooth Cubic Bezier curve (relative)-sR :: Show a => a -> a -> a -> a -> Text+sR :: RealFloat a => a -> a -> a -> a -> Text sR dc2x dc2y dx dy = T.concat ["s ", toText dc2x, ",", toText dc2y, " ", toText dx, ",", toText dy, " "] -- | Quadratic Bezier curve (absolute)-qA :: Show a => a -> a -> a -> a -> Text+qA :: RealFloat a => a -> a -> a -> a -> Text qA cx cy x y = T.concat ["Q ", toText cx, ",", toText cy, " ", toText x, ",", toText y, " "] -- | Quadratic Bezier curve (relative)-qR :: Show a => a -> a -> a -> a -> Text+qR :: RealFloat a => a -> a -> a -> a -> Text qR dcx dcy dx dy = T.concat ["q ", toText dcx, ",", toText dcy, " ", toText dx, ",", toText dy, " " ] -- | Smooth Quadratic Bezier curve (absolute)-tA :: Show a => a -> a -> Text+tA :: RealFloat a => a -> a -> Text tA x y = T.concat ["T ", " ", toText x, ",", toText y, " "] -- | Smooth Quadratic Bezier curve (relative)-tR :: Show a => a -> a -> Text+tR :: RealFloat a => a -> a -> Text tR x y = T.concat [ "t ", toText x, ",", toText y, " "] -- | Arc (absolute)-aA :: Show a => a -> a -> a -> a -> a -> a -> a -> Text+aA :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text aA rx ry xrot largeFlag sweepFlag x y = T.concat [ "A ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag , " ", toText sweepFlag, " ", toText x, " ", toText y, " "] -- | Arc (relative)-aR :: Show a => a -> a -> a -> a -> a -> a -> a -> Text+aR :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text aR rx ry xrot largeFlag sweepFlag x y = T.concat [ "a ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag , " ", toText sweepFlag, " ", toText x, " ", toText y, " "]@@ -112,32 +115,32 @@ -- | SVG Transform components -- | Specifies a translation by @x@ and @y@-translate :: Show a => a -> a -> Text+translate :: RealFloat a => a -> a -> Text translate x y = T.concat ["translate(", toText x, " ", toText y, ")"] -- | Specifies a scale operation by @x@ and @y@-scale :: Show a => a -> a -> Text+scale :: RealFloat a => a -> a -> Text scale x y = T.concat ["scale(", toText x, " ", toText y, ")"] -- | Specifies a rotation by @rotate-angle@ degrees-rotate :: Show a => a -> Text+rotate :: RealFloat a => a -> Text rotate angle = T.concat ["rotate(", toText angle, ")"] -- | Specifies a rotation by @rotate-angle@ degrees about the given time @rx,ry@-rotateAround :: Show a => a -> a -> a -> Text+rotateAround :: RealFloat a => a -> a -> a -> Text rotateAround angle rx ry = T.concat ["rotate(", toText angle, ",", toText rx, ",", toText ry, ")"] -- | Skew tansformation along x-axis-skewX :: Show a => a -> Text+skewX :: RealFloat a => a -> Text skewX angle = T.concat ["skewX(", toText angle, ")"] -- | Skew tansformation along y-axis-skewY :: Show a => a -> Text+skewY :: RealFloat a => a -> Text skewY angle = T.concat ["skewY(", toText angle, ")"] -- | Specifies a transform in the form of a transformation matrix-matrix :: Show a => a -> a -> a -> a -> a -> a -> Text+matrix :: RealFloat a => a -> a -> a -> a -> a -> a -> Text matrix a b c d e f = T.concat [ "matrix(", toText a, ",", toText b, ",", toText c , ",", toText d, ",", toText e, ",", toText f, ")"]