svg-icons 2.9.0.0 → 2.9.1.0
raw patch · 3 files changed
+95/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ SvgIcons.Core.Utils: rectangleWithRoundCorners :: Float -> (Float, Float) -> (Float, Float) -> Path
+ SvgIcons.Icons.Computer: diskette :: Svg
+ SvgIcons.Icons.Computer: save :: Svg
Files
- src/SvgIcons/Core/Utils.hs +29/−1
- src/SvgIcons/Icons/Computer.hs +65/−3
- svg-icons.cabal +1/−1
src/SvgIcons/Core/Utils.hs view
@@ -10,6 +10,7 @@ , horizontalMirrorMatrix , verticalMirrorMatrix , frame + , rectangleWithRoundCorners ) where import Data.Char @@ -96,7 +97,7 @@ {- | -`frame` is mainly used for testing purposes. +`frame` is mainly used for testing purposes. It draws coordinate axis. Takes the 4 numbers of the viewbox @(x0, y0, width, height)@ and returns a path which connects all @@ -130,3 +131,30 @@ l (x + w/2) (y + h) m x (y + h/2) l (x + w) (y + h/2) + + +{- | +Path of a rectangle with rounded corners. +-} +rectangleWithRoundCorners + :: Float -- ^ corner radius + -> (Float, Float) -- ^ (semiwidth, semiheight) + -> (Float, Float) -- ^ central point (intersection of diagonals) + -> S.Path -- ^ resulting path +rectangleWithRoundCorners r0 (w0,h0) (px,py) = + let + x1 = px - w0 + x2 = px + w0 + y1 = py - h0 + y2 = py + h0 + in + do + m (x1 + r0) (y1 ) + aa r0 r0 0 False False (x1 ) (y1 + r0) + l (x1 ) (y2 - r0) + aa r0 r0 0 False False (x1 + r0) (y2 ) + l (x2 - r0) (y2 ) + aa r0 r0 0 False False (x2 ) (y2 - r0) + l (x2 ) (y1 + r0) + aa r0 r0 0 False False (x2 - r0) (y1 ) + S.z
src/SvgIcons/Icons/Computer.hs view
@@ -14,6 +14,8 @@ , menuLines , powerButton , warning + , diskette + , save ) where import Text.Blaze.Svg11 ((!)) @@ -30,7 +32,7 @@ >svgComputer :: [ (String , S.Svg) ] >svgComputer = -> [ (,) "ring" ring +> [ (,) "ring" ring > , (,) "accept" accept > , (,) "cancel" cancel > , (,) "plus" plus @@ -40,11 +42,13 @@ > , (,) "menuLines" menuLines > , (,) "powerButton" powerButton > , (,) "warning" warning +> , (,) "diskette" diskette +> , (,) "save" save > ] -} svgComputer :: [ (String , S.Svg) ] svgComputer = - [ (,) "ring" ring + [ (,) "ring" ring , (,) "accept" accept , (,) "cancel" cancel , (,) "plus" plus @@ -54,6 +58,8 @@ , (,) "menuLines" menuLines , (,) "powerButton" powerButton , (,) "warning" warning + , (,) "diskette" diskette + , (,) "save" save ] @@ -355,4 +361,60 @@ aa w w 0 True False (-w) (-y1) l (-w) ( y1) aa w w 0 True False ( w) ( y1) - S.z+ S.z + + + +{- | + + + + + +-} +diskette :: Svg +diskette = + S.path + ! A.d shell + ! A.fillRule "evenodd" + where + k0 = 0.9 + r0 = 0.06 + r1 = 3*r0 + (px,py) = (0 ,-0.55) + (pw,ph) = (0.5 , 0.29) + (qx,qy) = (0 , 0.35) + (qw,qh) = (0.65 , 0.45) + (tx,ty) = (0.2 ,-0.54) + (tw,th) = (0.1 , 0.23) + rq = 0.05 + shell = mkPath $ do + m 0 (-k0 ) + l (-k0 + r0) (-k0 ) + aa r0 r0 0 False False (-k0 ) (-k0 + r0) + l (-k0 ) ( k0 - r0) + aa r0 r0 0 False False (-k0 + r0) ( k0 ) + l ( k0 - r0) ( k0 ) + aa r0 r0 0 False False ( k0 ) ( k0 - r0) + l ( k0 ) (-k0 + r1) + l ( k0 - r1) (-k0 ) + S.z + rectangleWithRoundCorners rq (qw,qh) (qx,qy) + rectangleWithRoundCorners rq (pw,ph) (px,py) + rectangleWithRoundCorners 0.01 (tw,th) (tx,ty) + + + +{- | + + + + + +-} +save :: Svg +save = + S.g $ do + diskette + accept + ! A.transform (translate 0 0.4 <> S.scale 0.5 0.5)
svg-icons.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: svg-icons -version: 2.9.0.0 +version: 2.9.1.0 homepage: https://github.com/RamiroPastor/SvgIcons license: BSD-3-Clause license-file: LICENSE