svg-icons (empty) → 0.1.0.0
raw patch · 19 files changed
+6127/−0 lines, 19 filesdep +basedep +blaze-markupdep +blaze-svg
Dependencies added: base, blaze-markup, blaze-svg, directory, text
Files
- LICENSE +30/−0
- src/Core/Geometry.hs +171/−0
- src/Core/Render.hs +131/−0
- src/Core/Style.hs +77/−0
- src/Core/Utils.hs +142/−0
- src/Icons/Business.hs +275/−0
- src/Icons/Computer.hs +297/−0
- src/Icons/Cosmos.hs +114/−0
- src/Icons/Human.hs +295/−0
- src/Icons/Math.hs +102/−0
- src/Icons/Office.hs +540/−0
- src/Icons/Religion.hs +355/−0
- src/Icons/Textarea.hs +633/−0
- src/Icons/Tools.hs +218/−0
- src/Images/Flags.hs +1483/−0
- src/Images/FlagsCoA.hs +99/−0
- src/Images/Mosaics.hs +939/−0
- src/Main.hs +129/−0
- svg-icons.cabal +97/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2022, Ramiro + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Ramiro nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ src/Core/Geometry.hs view
@@ -0,0 +1,171 @@+{-# LANGUAGE OverloadedStrings #-} + + + +{- +Module for geometrical shapes. +-} + +module Core.Geometry + ( regularPolygon + , starPolygonFirstSpecies + , starOutline + , starFat + , starRegular + ) where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +-------------------------------------------------------------------------------- + +{- | +`regularPolygon` builds a regular polygon. + +You can customize fill and stroke using the +usual `blaze-svg` functions. For example: +>regularPolygon 5 100 (200,300) +> ! A.fill "pink" +> ! A.stroke "#0000FF" +> ! A.strokeWidth "10" +will return a path element corresponding to a +regular pentagon of radius 100 centered at point +(200,300) filled in pink, green stroke and stroke +width 10. +-} +regularPolygon + :: Int -- ^ number of vertices + -> Float -- ^ circumradius + -> (Float , Float) -- ^ coordinates of the central point + -> Svg -- ^ resulting svg path +regularPolygon n r (x0,y0) = + S.path + ! A.d directions + where + α = 2 * pi / (fromIntegral n) + draw k = + l (x0 + r * sin (k*α)) + (y0 - r * cos (k*α)) + directions = + mkPath $ do + m x0 (y0 - r) + mapM_ (draw . fromIntegral) [1..n] + S.z + + + +{- +`starPolygonFirstSpecies` builds a first species regular star polygon. + +First species means that one vertice is skipped when joining vertices. +The number of vertices must be strictly greater than 4. +Can be customized with the usual `blaze-svg` functions. +-} +starPolygonFirstSpecies + :: Int -- ^ number of vertices + -> Float -- ^ circumradius + -> (Float , Float) -- ^ coordinates of the central point + -> Svg -- ^ resulting svg path +starPolygonFirstSpecies n r (c1,c2) = + S.path + ! A.d directions + where + α = 2 * pi / (fromIntegral n) + vertice k' = + let k = fromIntegral k' + in + (,) (c1 + r * sin (k*α)) + (c2 - r * cos (k*α)) + verticesList = map vertice [0 .. (n-1)] + directions = + if even n + then + mkPath $ do + m (fst $ head verticesList) (snd $ head verticesList) + mapM_ (uncurry S.l) (fst $ evenOddSplit verticesList) + S.z + m (fst $ verticesList !! 1) (snd $ verticesList !! 1) + mapM_ (uncurry S.l) (snd $ evenOddSplit verticesList) + S.z + else + mkPath $ do + m (fst $ head verticesList) (snd $ head verticesList) + mapM_ (uncurry S.l) (tail $ fst $ evenOddSplit $ verticesList ++ verticesList) + S.z + + + +{- | +`starOutline` builds a first species irregular star polygon. + +The difference with the previous function is the stroke: +The previous function's stroke runs inside the figure +(so it would draw a pentagram), while this funtion's stroke +runs outside the shape (so it would draw a star). +There is no visual difference if you only fill the paths (with no stroke). +-} +starOutline + :: Int -- ^ number of vertices + -> Float -- ^ circumradius + -> Float -- ^ inner radius (circumradius of the inner polygon) + -> (Float , Float) -- ^ coordinates of the central point + -> Svg -- ^ resulting path +starOutline n r1 r2 (c1,c2) = + S.path + ! A.strokeMiterlimit "100" + ! A.d directions + where + β = 2 * pi / (fromIntegral n) + outerV k = (,) + (c1 + r1 * sin (k*β)) + (c2 - r1 * cos (k*β)) + innerV k = (,) + (c1 + r2 * sin (k*β + β/2)) + (c2 - r2 * cos (k*β + β/2)) + vertices = + foldr + (\k acc -> (outerV k) : (innerV k) : acc) + [] + (map fromIntegral [0 .. (n-1)]) + directions = mkPath $ do + m (fst $ head vertices) (snd $ head vertices) + mapM_ (uncurry S.l) (tail vertices) + S.z + + + +{- | +`starFat` builds a first species irregular star polygon. + +Works as `starOutline` but you don't need to specify +the inner radius, it is already coded so that you get a +"fat" star. +-} +starFat :: + Int -> Float -> (Float , Float) -> Svg +starFat n r1 (c1,c2) = + starOutline n r1 r2 (c1,c2) + where + β = 2 * pi / (fromIntegral n) + r2 = r1 * (1 - sin(β/2)*tan(β/2)) + + + +{- | +`starRegular` builds a first species regular star polygon. + +Works as `starOutline` but you don't need to specify +the inner radius, and you will get a regular star. +-} +starRegular :: + Int -> Float -> (Float , Float) -> Svg +starRegular n r1 (c1,c2) = + starOutline n r1 r2 (c1,c2) + where + β = 2 * pi / (fromIntegral n) + r2 = r1 * (2*cos(β/2) - 1/cos(β/2))
+ src/Core/Render.hs view
@@ -0,0 +1,131 @@+{-# LANGUAGE OverloadedStrings #-} + + +module Core.Render + ( renderSvgFiles + , renderSvgReact + , svgToReact + ) where + +import GHC.IO.Encoding +import qualified Data.Text as T +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A +import Text.Blaze.Svg.Renderer.Pretty + +import Core.Utils + + + +{- | +`renderSvgFiles` renders svg code to .svg files. + +Takes a folder path in your computer and a list +of pairs `(String, Svg)` and renders the svg code of every +second element into a svg file named as the first element. +You should not write the .svg file extension in the first element. +This function also adds the correct DOCTYPE and xml:ns + +Example use: +>renderSvgFiles +> "./assets/img/" +> [ (,) "sun" (sun 14) +> , (,) "moon" moon +> , (,) "crescent" crescent +> ] +This will create 3 files inside the ./assets/svg/ folder, +namely sun.svg, moon.svg and crescent.svg +-} +renderSvgFiles :: FilePath -> [ (FilePath , Svg) ] -> IO () +renderSvgFiles folder svgs = + do + setLocaleEncoding utf8 + mapM_ f svgs + where + f (name , svgCode) = + writeFile + (folder ++ name ++ ".svg") + (renderSvg $ S.docType >> addXmlns svgCode) + + + +{- | +`renderSvgReact` renders svg code to .jsx files + +Works as the previous function but creates .jsx files +instead of .svg files. This function does not prepend +the svg DOCTYPE but it does prepend the React import and +an export line. + +Example use: +>myCancelIcon :: Svg +>myCancelIcon = +> svg +> ! viewbox "-1 -1 2 2" +> $ cancel +> ! fill "deeppink" +> +>renderSvgReact +> "./assets/svg/" +> [ (,) "cancel" myCancelIcon +> ] +This call will create a cancel.jsx file inside the ./assets/svg/ folder +with the following code inside: +>import React from 'react'; +> +>export const cancel = +><svg viewBox="-1 -1 2 2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +> <g fill="deeppink"> +> <path d="M 0.1,-0.1 L 0.1,-0.8 A 0.1,0.1 0.0 1,0 -0.1,-0.8 L -0.1,-0.1 L -0.8,-0.1 A 0.1,0.1 0.0 1,0 -0.8,0.1 L -0.1,0.1 L -0.1,0.8 A 0.1,0.1 0.0 1,0 0.1,0.8 L 0.1,0.1 L 0.8,0.1 A 0.1,0.1 0.0 1,0 0.8,-0.1 Z" transform="rotate(45,0,0)" /> +> </g> +></svg> +-} +renderSvgReact :: FilePath -> [ (FilePath , Svg) ] -> IO () +renderSvgReact folder svgs = + do + setLocaleEncoding utf8 + mapM_ f svgs + where + f (name , svgCode) = + writeFile + (folder ++ name ++ ".jsx") + (svgToReact name $ addXmlns svgCode) + + + +{- | +`svgToReact` is internally used in the previous function +so you don't have to call it manually. + +This function writes the "import React from 'react';" line +and the export line; and more importantly, changes all hyphen-joined +attributes to camelCase, because React will complain otherwise. +For example, "stroke-width" changes to "strokeWidth" and "text-anchor" +changes to "textAnchor". + +IMPORTANT: This function does not currently aim to be exhaustive, +which means that you may encounter some hyphen-joined attribute which +is not converted to camelCase and raises a React error. You can ask +for an update in this function if you have such problem. +-} +svgToReact :: String -> Svg -> String +svgToReact name svgCode = + "import React from 'react';" + ++ "\n\n" ++ + "export const " ++ name ++ " = \n" ++ render svgCode + where + render = T.unpack . adaptToReact . T.pack . renderSvg + adaptToReact = + (T.replace "xmlns:xlink" "xmlnsXlink") + . (T.replace "stroke-width" "strokeWidth") + . (T.replace "stroke-dasharray" "strokeDasharray") + . (T.replace "stroke-dashoffset" "strokeDashoffset") + . (T.replace "stroke-linejoin" "strokeLinejoin") + . (T.replace "stroke-linecap" "strokeLinecap") + . (T.replace "font-family" "fontFamily") + . (T.replace "font-size" "fontSize") + . (T.replace "text-anchor" "textAnchor") + . (T.replace "letter-spacing" "letterSpacing") + . (T.replace "dominant-baseline" "dominantBaseline") + . (T.replace "stroke-miterlimit" "strokeMiterlimit")
+ src/Core/Style.hs view
@@ -0,0 +1,77 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Core.Style + ( stdDims + , strkStyle + , fillStyle + , fullStyle + ) where + +import Text.Blaze.Svg11 ((!)) +import qualified Text.Blaze.Svg11 as S +import qualified Text.Blaze.Svg11.Attributes as A + + + + +{- | +`stdDims` takes some svg content and wraps it with the +`svg` tag, with attributes @viewbox="-1 -1 2 2"@, @height="300px"@ +and @width="300px"@ +-} +stdDims :: S.Svg -> S.Svg +stdDims content = + S.svg content + ! A.viewbox "-1 -1 2 2" + ! A.height "100px" + ! A.width "100px" + + + +{- | +Handy shortcut for the following attributes: +* @fill="none"@ +* @stroke="black"@ +* @stroke-width="0.04"@ +-} +strkStyle :: S.Svg -> S.Svg +strkStyle svg = + svg + ! A.fill "none" + ! A.stroke "black" + ! A.strokeWidth "0.04" + + + +{- | +Handy shortcut for the following attributes: +* @fill="black"@ +* @stroke="none"@ +* @stroke-width="0"@ +-} +fillStyle :: S.Svg -> S.Svg +fillStyle svg = + svg + ! A.fill "black" + ! A.stroke "none" + ! A.strokeWidth "0" + + + +{- | +Handy shortcut for the following attributes: +* @fill="silver"@ +* @stroke="black"@ +* @stroke-width="0.03"@ +-} +fullStyle :: S.Svg -> S.Svg +fullStyle svg = + svg + ! A.fill "silver" + ! A.stroke "black" + ! A.strokeWidth "0.03" + + +
+ src/Core/Utils.hs view
@@ -0,0 +1,142 @@+{-# LANGUAGE OverloadedStrings #-} + + +{- | +Module : Core.Utils +Description : Utilities for svg coding +-} +module Core.Utils + ( evenOddSplit + , addXmlns + , (.:) + , distance + , horizontalMirrorMatrix + , verticalMirrorMatrix + , frame + ) where + +import Data.Char +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + + + +{- | +Splits a list into two lists: +* The first one contains all the elements in odd positions +* The second one contains all the elements in even positions +-} +evenOddSplit :: [a] -> ([a], [a]) +evenOddSplit [] = ([], []) +evenOddSplit (x:xs) = (x:o, e) + where (e,o) = evenOddSplit xs + + + +{- | +Takes some `Svg` entity and adds two attributes: +* @xmlns="http://www.w3.org/2000/svg"@ +* @xmlns:xlink="http://www.w3.org/1999/xlink"@ +-} +addXmlns :: Svg -> Svg +addXmlns svg = + svg + ! customAttribute "xmlns" "http://www.w3.org/2000/svg" + ! customAttribute "xmlns:xlink" "http://www.w3.org/1999/xlink" + + + +{- | +Handy operator that converts a `Float` number +into an `AttributeValue` and feeds it to the `Attribute` function. + +Example: +>S.path +> ! (A.strokeWidth .: 0.1) +-} +infixl 5 .: +(.:) :: (AttributeValue -> Attribute ) -> Float -> Attribute +f .: x = f $ S.toValue x + + + +{- | +Euclidian distance between two points. +-} +distance :: (Float, Float) -> (Float, Float) -> Float +distance (ax,ay) (bx,by) = + sqrt $ (bx - ax)**2 + (by - ay)**2 + + + +{- | +Matrix for the horizontal symmetry __respect to the axis @x=0@__. +Use it with the transform `Attribute`: +>S.path +> ! A.transform horizontalMirrorMatrix +-} +horizontalMirrorMatrix :: AttributeValue +horizontalMirrorMatrix = + matrix (-1) 0 0 1 0 0 + + + +{- | +Matrix for the vertical symmetry __respect to the axis @y=0@__. +Use it with the transform `Attribute`: +>S.path +> ! A.transform (verticalMirrorMatrix <> rotateAround 45 0 0) +-} +verticalMirrorMatrix :: AttributeValue +verticalMirrorMatrix = + matrix 1 0 0 (-1) 0 0 + + + +{- | +`frame` is mainly used for testing purposes. + +Takes the 4 numbers of the viewbox (x0, y0, width, height) +and returns a path with a very thin stroke which connects all +consecutive corners of the viewbox and also connects opposite +middle points. +-} +frame :: Float -> Float -> Float -> Float -> S.Svg +frame x y w h = + S.path + ! A.fill "none" + ! A.stroke "black" + ! A.strokeWidth "0.002" + ! A.d frameDirs + where + frameDirs = mkPath $ do + m x y + l x (y + h) + l (x + w) (y + h) + l (x + w) y + S.z + m (x + w/2) y + l (x + w/2) (y + h) + m x (y + h/2) + l (x + w) (y + h/2) + + +-- Takes a number n and a string s, +-- and returns a string equal to s except that every decimal +-- number inside s will have its decimal part capped at n digits +cleanDecimals :: Int -> String -> String +cleanDecimals n s = + f [] [] s + where + f _ acc [] = reverse acc + f aux acc (c:cs) = + if c == '.' + then f "." acc cs + else if aux == [] + then f [] (c : acc) cs + else if (not $ isDigit c) + then f [] (c : aux ++ acc) cs + else if (length aux < n) + then f (c : aux) acc cs + else f aux acc cs
+ src/Icons/Business.hs view
@@ -0,0 +1,275 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Business + ( svgBusiness + , company + , connections + , analytics + , bullseye + ) where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgBusiness :: [ (String , S.Svg) ] +>svgBusiness = +> [ (,) "company" company +> , (,) "connections" connections +> , (,) "analytics" analytics +> , (,) "bullseye" bullseye +> ] +-} +svgBusiness :: [ (String , S.Svg) ] +svgBusiness = + [ (,) "company" company + , (,) "connections" connections + , (,) "analytics" analytics + , (,) "bullseye" bullseye + ] + + +-------------------------------------------------------------------------------- + +{- | + + + +-} +company :: S.Svg +company = + S.g $ do + S.path + ! d leftBuildingPath + S.path + ! d leftWindowsPath + ! strokeDasharray "0.12 0.06" + S.path + ! d rightBuildingPath + S.path + ! d rightWindowsPath + ! strokeDasharray "0.05" + where + x1 = -0.92 + x2 = -0.72 + x3 = 0 + x4 = 0.22 + x5 = 0.92 + y1 = -0.9 + y2 = -0.75 + y3 = (y1 + y4) / 2 + y4 = -0.3 + y5 = -0.2 + y6 = 0.8 + y7 = 0.9 + k1 = (x3 - x2) / 3 + k2 = (x5 - x4) / 4 + doorH = 0.24 + ---------------------------------------- + leftBuildingPath = + mkPath $ do + m x1 y7 + l x1 y2 + l x2 y2 + l x2 y1 + l x3 y1 + l x3 y2 + l x4 y2 + l x4 y7 + doorPath + S.z + rightBuildingPath = + mkPath $ do + m x4 y4 + l x5 y4 + l x5 y7 + l x4 y7 + S.z + doorPath = + do + l (x2 + 2*k1) y7 + l (x2 + 2*k1) (y7 - doorH) + l (x2 + k1) (y7 - doorH) + l (x2 + k1) y7 + leftWindowsPath = + mkPath $ do + m (x2 + 0*k1) y3 + l (x2 + 0*k1) y6 + m (x2 + 1*k1) y3 + l (x2 + 1*k1) (y7 - 1.5 * doorH) + m (x2 + 2*k1) y3 + l (x2 + 2*k1) (y7 - 1.5 * doorH) + m (x2 + 3*k1) y3 + l (x2 + 3*k1) y6 + rightWindowsPath = + mkPath $ do + m (x4 + 1*k2) y5 + l (x4 + 1*k2) y6 + m (x4 + 2*k2) y5 + l (x4 + 2*k2) y6 + m (x4 + 3*k2) y5 + l (x4 + 3*k2) y6 + + + +{- | + + + +-} +connections :: Svg +connections = + S.g $ do + circ x0 y0 r0 + circ x1 y1 r1 + circ x2 y2 r2 + circ x3 y3 r3 + circ x4 y4 r4 + circ x5 y5 r5 + circ x6 y6 r6 + circ x7 y7 r7 + circ x8 y8 r8 + circ x9 y9 r9 + S.path + ! A.fill "none" + ! d (mkPath connectingLines) + where + rad1 = 0.2 + rad2 = 0.12 + (x0,y0,r0) = (,,) ( 0 ) ( 0 ) 0.3 + (x1,y1,r1) = (,,) (-0.64) ( 0 ) rad1 + (x2,y2,r2) = (,,) ( 0.56) (-0.4 ) rad1 + (x3,y3,r3) = (,,) ( 0.56) ( 0.4 ) rad1 + (x4,y4,r4) = (,,) (-0.64) (-0.6 ) rad2 + (x5,y5,r5) = (,,) (-0.82) ( 0.4 ) rad2 + (x6,y6,r6) = (,,) (-0.4 ) ( 0.7 ) rad2 + (x7,y7,r7) = (,,) ( 0.1 ) (-0.74) rad2 + (x8,y8,r8) = (,,) ( 0.80) (-0.8 ) rad2 + (x9,y9,r9) = (,,) ( 0.56) ( 0.8 ) rad2 + circ c1 c2 radius = + circle + ! (cx .: c1) + ! (cy .: c2) + ! (r .: radius) + connect (p1,p2,radius1) (q1,q2,radius2) = + let + d = distance (p1,p2) (q1,q2) + k1 = radius1 / d + k2 = radius2 / d + in do + m (k2*p1 + q1 - k2*q1) (k2*p2 + q2 - k2*q2) + l (p1 - k1*p1 + k1*q1) (p2 - k1*p2 + k1*q2) + connectingLines = do + connect (x0,y0,r0) (x1,y1,r1) + connect (x0,y0,r0) (x2,y2,r2) + connect (x0,y0,r0) (x3,y3,r3) + connect (x1,y1,r1) (x4,y4,r4) + connect (x1,y1,r1) (x5,y5,r5) + connect (x1,y1,r1) (x6,y6,r6) + connect (x2,y2,r2) (x7,y7,r7) + connect (x2,y2,r2) (x8,y8,r8) + connect (x3,y3,r3) (x9,y9,r9) + + + +{- | + + + +-} +analytics :: Svg +analytics = + S.g $ do + S.path + ! A.fill "none" + ! A.d axesPath + S.path ! A.d (bar x1 y1) + S.path ! A.d (bar x2 y2) + S.path ! A.d (bar x3 y3) + where + ax = 0.96 + ay = 0.96 + w = 0.14 + x1 = -0.5 + x2 = 0 + x3 = 0.5 + y1 = -0.1 + y2 = -0.4 + y3 = -0.7 + axesPath = mkPath $ do + m (-ax) (-ay) + l (-ax) ( ay) + l ( ax) ( ay) + bar px py = mkPath $ do + m (px - w) ay + l (px - w) py + l (px + w) py + l (px + w) ay + S.z + + + +{- | + + + +-} +bullseye :: Svg +bullseye = + S.g $ do + S.path + ! A.strokeLinecap "round" + ! A.d circles + S.path + ! strokeLinecap "round" + ! fill "none" + ! A.d (mkPath $ stick >> feathers) + where + distanceToCenter x y = distance (x,y) (0,0) + (p1,k1) = (,) (-0.6 ) 0.1 + (p2,k2) = (,) (-0.44) 0.07 + (p3,k3) = (,) (-0.28) 0.07 + (p4,k4) = (,) (-0.12) 0.05 + d1 = distanceToCenter (p1 + k1) (p1 - k1) + d2 = distanceToCenter (p2 + k2) (p2 - k2) + d3 = distanceToCenter (p3 + k3) (p3 - k3) + d4 = distanceToCenter (p4 + k4) (p4 - k4) + circles = mkPath $ do + m (p1 + k1) (p1 - k1) + aa d1 d1 0 True True (p1 - k1) (p1 + k1) + m (p2 + k2) (p2 - k2) + aa d2 d2 0 True True (p2 - k2) (p2 + k2) + m (p3 + k3) (p3 - k3) + aa d3 d3 0 True True (p3 - k3) (p3 + k3) + m (p4 + k4) (p4 - k4) + aa d4 d4 0 True True (p4 - k4) (p4 + k4) + fl = 0.2 -- feather length + q1 = -0.76 + q2 = -0.68 + q3 = -0.6 + stick = do + m q1 q1 + l (-0.01) (-0.01) + feathers = do + m q1 q1 + l q1 (q1 - fl) + m q1 q1 + l (q1 - fl) q1 + m q2 q2 + l q2 (q2 - fl) + m q2 q2 + l (q2 - fl) q2 + m q3 q3 + l q3 (q3 - fl) + m q3 q3 + l (q3 - fl) q3
+ src/Icons/Computer.hs view
@@ -0,0 +1,297 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Computer where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgComputer :: [ (String , S.Svg) ] +>svgComputer = +> [ (,) "plus" plus +> , (,) "cancel" cancel +> , (,) "accept" accept +> , (,) "warning" warning +> , (,) "minimize" minimize +> , (,) "maximize" maximize +> , (,) "menuDots" menuDots +> , (,) "menuLines" menuLines +> , (,) "powerButton" powerButton +> ] +-} +svgComputer :: [ (String , S.Svg) ] +svgComputer = + [ (,) "plus" plus + , (,) "cancel" cancel + , (,) "accept" accept + , (,) "warning" warning + , (,) "minimize" minimize + , (,) "maximize" maximize + , (,) "menuDots" menuDots + , (,) "menuLines" menuLines + , (,) "powerButton" powerButton + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +plus :: Svg +plus = + S.path + ! A.d dirs + where + k1 = 0.1 + k2 = 0.8 + dirs = mkPath $ do + m ( k1) (-k1) + l ( k1) (-k2) + aa k1 k1 0 True False (-k1) (-k2) + l (-k1) (-k1) + l (-k2) (-k1) + aa k1 k1 0 True False (-k2) ( k1) + l (-k1) ( k1) + l (-k1) ( k2) + aa k1 k1 0 True False ( k1) ( k2) + l ( k1) ( k1) + l ( k2) ( k1) + aa k1 k1 0 True False ( k2) (-k1) + S.z + + + +{- | + + + +-} +cancel :: Svg +cancel = + S.g $ + plus ! A.transform (rotateAround 45 0 0) + + + +{- | + + + +-} +accept :: Svg +accept = + S.g $ do + S.path + ! A.strokeLinejoin "round" + ! d dirs + ! A.transform (translate (-0.3) 0.3 <> rotateAround 45 0 0) + where + k1 = 0.1 + k2 = 0.5 + k3 = 1.3 + dirs = mkPath $ do + m (-k1) (-k1) + l (-k2) (-k1) + aa k1 k1 0 True False (-k2) ( k1) + l ( k1) ( k1) + l ( k1) (-k3) + aa k1 k1 0 True False (-k1) (-k3) + S.z + + + +{- | + + + +-} +warning :: Svg +warning = + S.g $ do + S.path + ! d triangleDirs + ! strokeLinejoin "round" + ! fillRule "evenodd" + S.path + ! d stickPath + S.circle + ! (cx .: 0) + ! (cy .: 0.15) + ! (r .: w) + where + w = 0.1 + ap1 = 0.36 + ap2 = ap1 + w + lm1 = (sqrt 3) * ap1 + lm2 = (sqrt 3) * ap2 + y1 = -0.3 + y2 = -0.05 + triangleDirs = mkPath $ do + m 0 (-2*ap2) + l (-lm2) ( ap2) + l ( lm2) ( ap2) + S.z + m 0 (-2*ap1) + l (-lm1) ( ap1) + l ( lm1) ( ap1) + S.z + stickPath = mkPath $ do + m (-w) y1 + l (-w/2) y2 + aa ( w/2) (w/2) 0 True False (w/2) y2 + l ( w) y1 + aa w w 0 True False (-w) y1 + S.z + + + +{- | + + + +-} +minimize :: Svg +minimize = + S.path + ! A.d dirs + where + w = 0.1 + k = 0.7 + dirs = mkPath $ do + m (-k) (-w) + aa ( w) ( w) 0 True False (-k) ( w) + l ( k) ( w) + aa ( w) ( w) 0 True False ( k) (-w) + S.z + + + +{- | + + + +-} +maximize :: Svg +maximize = + S.g $ do + S.path + ! A.d dirs1 + ! A.transform (translate (k - 0.15) (0.15 - k)) + ! A.stroke "none" + ! A.opacity "0.5" + S.path + ! A.d dirs2 + ! A.transform (translate ( - 0.15) 0.15) + ! A.fill "none" + S.path + ! A.d dirs1 + ! A.transform (translate (-0.1 ) 0.1) + where + w = 1.4 + k = 0.25 + dirs1 = mkPath $ do + m (-0.5 * w) (-0.5 * w) + l ( 0.5 * w) (-0.5 * w) + l ( 0.5 * w) ( 0.5 * w) + l (-0.5 * w) ( 0.5 * w) + S.z + dirs2 = mkPath $ do + m (-0.5*w + k) (-0.5*w - k) + l ( 0.5*w + k) (-0.5*w - k) + l ( 0.5*w + k) ( 0.5*w - k) + + + +{- | + + + +-} +menuDots :: Svg +menuDots = + S.g $ do + dot (-0.7) + dot ( 0 ) + dot ( 0.7) + where + dot y = + circle + ! (A.cy .: y) + ! A.cx "0" + ! A.r "0.2" + + + +{- | + + + +-} +menuLines :: Svg +menuLines = + S.g $ do + S.path ! A.d (line (-0.5)) + S.path ! A.d (line ( 0 )) + S.path ! A.d (line ( 0.5)) + where + kx = 0.7 + r = 0.12 + line y = mkPath $ do + m (-kx) (y - r) + aa r r 0 True False (-kx) (y + r) + l ( kx) (y + r) + aa r r 0 True False ( kx) (y - r) + S.z + + + +{- | + + + +-} +powerButton :: S.Svg +powerButton = + S.g $ do + S.path + ! d innerCircle + ! A.transform (translate 0 0.1) + S.path + ! d littleStickPath + ! A.transform (translate 0 (-0.42)) + where + w = 0.08 + r1 = 0.7 + r2 = r1 + 2*w + α = pi / 8 + y1 = 0.4 + innerCircle = + mkPath $ do + m (r1 * sin α) (-r1 * cos α) + aa w w 0 True True ( r2 * sin α) (-r2 * cos α) + aa r2 r2 0 True True (-r2 * sin α) (-r2 * cos α) + aa w w 0 True True (-r1 * sin α) (-r1 * cos α) + aa r1 r1 0 True False ( r1 * sin α) (-r1 * cos α) + S.z + littleStickPath = + mkPath $ do + m w (-y1) + aa w w 0 True False (-w) (-y1) + l (-w) ( y1) + aa w w 0 True False ( w) ( y1) + S.z
+ src/Icons/Cosmos.hs view
@@ -0,0 +1,114 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Cosmos where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgCosmos :: [ (String , S.Svg) ] +>svgCosmos = +> [ (,) "sun" (sun 14) +> , (,) "moon" moon +> , (,) "crescent" crescent +> ] +-} +svgCosmos :: [ (String , S.Svg) ] +svgCosmos = + [ (,) "sun" (sun 14) + , (,) "moon" moon + , (,) "crescent" crescent + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + + +Takes a natural number @n@ which draws @2*n@ rays. +-} +sun :: Int -> Svg +sun n = + S.g $ do + S.circle + ! A.x "0" + ! A.y "0" + ! A.r "0.5" + S.path + ! A.strokeLinecap "round" + ! A.d rays + where + r1 = 0.6 + r2 = 0.78 + r3 = 0.96 + α = 2*pi / (fromIntegral n) + angles = [ n * α | n <- [0 .. (2*pi / α)]] + rays = + mkPath $ mapM_ doubleRay angles + doubleRay β = do + ray r2 β + ray r3 (β + α/2) + ray r β = do + m (r1 * cos β) (r1 * sin β) + l (r * cos β) (r * sin β) + + + +{- | + + + +-} +moon :: Svg +moon = + S.path + ! A.strokeLinejoin "round" + ! A.d moonDirs + where + kx = 0.72 + ky = 0.7 + r1 = 0.92 + r2 = 0.71 + moonDirs = mkPath $ do + m ( kx) (-ky) + aa r1 r1 0 True False ( kx) ( ky) + aa r2 r2 0 True True ( kx) (-ky) + S.z + + + +{- | + + + +-} +crescent :: Svg +crescent = + S.path + ! A.strokeLinejoin "round" + ! A.d moonDirs + where + kx = 0.55 + ky = 0.55 + r1 = 0.8 + r2 = 0.65 + moonDirs = mkPath $ do + m ( kx) (-ky) + aa r1 r1 0 True False ( kx) ( ky) + aa r2 r2 0 True True ( kx) (-ky) + S.z
+ src/Icons/Human.hs view
@@ -0,0 +1,295 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Human where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgHuman :: [ (String , S.Svg) ] +>svgHuman = +> [ (,) "eyeOpened" eyeOpened +> , (,) "eyeStriked" eyeStriked +> , (,) "person" person +> , (,) "people" people +> , (,) "carnet" carnet +> , (,) "heartFat" heartFat +> , (,) "heartSlim" heartSlim +> , (,) "talk" talk +> ] +-} +svgHuman :: [ (String , S.Svg) ] +svgHuman = + [ (,) "eyeOpened" eyeOpened + , (,) "eyeStriked" eyeStriked + , (,) "person" person + , (,) "people" people + , (,) "carnet" carnet + , (,) "heartFat" heartFat + , (,) "heartSlim" heartSlim + , (,) "talk" talk + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +eyeOpened :: S.Svg +eyeOpened = + S.g $ do + eye + pupil + glow + where + w = 0.9 + c1 = 0 + c2 = -0.2 + cr = 0.46 + k = 0.25 + eye = + S.path + ! A.d eyePath + ! A.strokeLinejoin "round" + ! A.fill "white" + eyePath = S.mkPath $ do + m (-w) 0 + c (-0.5) (-0.9) ( 0.5) (-0.9) ( w) 0 + c ( 0.5) ( 0.9) (-0.5) ( 0.9) (-w) 0 + S.z + pupil = + S.circle + ! (A.cx .: c1) + ! (A.cy .: c2) + ! (A.r .: cr) + glow = + S.path + ! A.d glowPath + ! A.fill "none" + ! A.stroke "white" + ! (A.strokeWidth .: 0.5 * k) + ! A.strokeLinecap "round" + glowPath = S.mkPath $ do + m (c1 - k) c2 + aa k k 0 False True c1 (c2 - k) + + + +{- | + + + +-} +eyeStriked :: S.Svg +eyeStriked = + S.g $ do + eyeOpened + bar + where + k = 0.9 + bar = + S.path + ! A.d barPath + ! A.strokeLinecap "round" + barPath = S.mkPath $ do + m ( k) (-k) + l (-k) ( k) + + + +{- | + + + +-} +person :: S.Svg +person = + S.g $ do + simpleShoulders + simpleHead + where + kx = 0.7 + ky = 0.52 + kr = (1 - kx) + simpleHead = + circle + ! cx "0" + ! cy "-0.5" + ! r "0.35" + simpleShoulders = + S.path + ! d shouldersPath + shouldersPath = + mkPath $ do + m kx ky + aa kr kr 0 True False (-kx) ky + aa kr 0.15 0 True False kx ky + + + +{- | + + + +-} +people :: S.Svg +people = + S.g $ do + person ! A.transform (translate 0.4 (-0.2) <> S.scale 0.8 0.8) + person ! A.transform (translate (-0.4) (-0.2) <> S.scale 0.8 0.8) + person ! A.transform (translate 0 ( 0.2) <> S.scale 0.9 0.9) + + + +{- | + + + +-} +carnet :: S.Svg +carnet = + S.g $ do + cardBorder + textLines ! A.transform (translate ( 0.4) 0 <> S.scale 0.5 0.5) + person ! A.transform (translate (-0.5) 0 <> S.scale 0.5 0.5) + where + w1 = 0.01 + x1 = 1.618 * y1 + y1 = 0.58 + cardBorder = + S.path + ! d cardBorderPath + ! fillRule "evenodd" + cardBorderPath = + mkPath $ do + m (-x1 - w1) (-y1 - w1) + l ( x1 + w1) (-y1 - w1) + l ( x1 + w1) ( y1 + w1) + l (-x1 - w1) ( y1 + w1) + S.z + m (-x1 + w1) (-y1 + w1) + l ( x1 - w1) (-y1 + w1) + l ( x1 - w1) ( y1 - w1) + l (-x1 + w1) ( y1 - w1) + S.z + w2 = 0.06 + h1 = -0.5 + h2 = 0 + h3 = 0.5 + k1 = -0.7 + k2 = 0.7 + textLines = + S.path + ! d (mkPath $ line h1 >> line h2 >> line h3) + line hy = do + m k1 (hy - w2) + aa w2 w2 0 True False k1 (hy + w2) + l k2 (hy + w2) + aa w2 w2 0 True False k2 (hy - w2) + S.z + + + +{- | + + + +-} +heartFat :: Svg +heartFat = + S.g $ do + S.path + ! A.d heartDirs + ! A.strokeLinejoin "round" + ! A.transform (translate 0 0.1 <> S.scale 1.2 1.2) + where + h = 0.06 + (h1x , h1y) = ( 0 , -0.6 ) + (h2x , h2y) = ( h1x - h , h1y - h ) + (h3x , h3y) = ( h2y , h2x ) + (h4x , h4y) = ( 0 , 0.6 ) + (hqx , hqy) = (-0.1 , 0.6 ) + rh = 0.5 * distance (h2x,h2y) (h3x,h3y) + heartDirs = mkPath $ do + m h1x h1y + l h2x h2y + aa rh rh 0 False False h3x h3y + q hqx hqy h4x h4y + q (-hqx) ( hqy) (-h3x) ( h3y) + aa rh rh 0 False False (-h2x) h2y + S.z + + + +{- | + + + +-} +heartSlim :: Svg +heartSlim = + S.g $ do + S.path + ! A.d heartDirs + ! A.strokeLinejoin "round" + where + h = 0.2 + (h1x , h1y) = ( 0 , -0.6 ) + (h2x , h2y) = ( h1x - h , h1y - h ) + (h3x , h3y) = ( h2y , h2x ) + (h4x , h4y) = ( 0 , 0.9 ) + (hqx , hqy) = (-0.1 , 0.4 ) + rh = 0.5 * distance (h2x,h2y) (h3x,h3y) + heartDirs = mkPath $ do + m h1x h1y + l h2x h2y + aa rh rh 0 False False h3x h3y + q hqx hqy h4x h4y + q (-hqx) ( hqy) (-h3x) ( h3y) + aa rh rh 0 False False (-h2x) h2y + S.z + + + +{- | + + + +-} +talk :: Svg +talk = + S.g $ do + S.path + ! A.d bubble + abc + where + bubble = mkPath $ do + m (-0.56) ( 0.62) + aa 0.94 0.78 0 True True 0 (0.78) + l (-0.60) ( 0.9) + S.z + abc = + S.text_ "ABC" + ! A.x "0" + ! A.y "0.18" + ! A.textAnchor "middle" + ! A.fontFamily "Verdana" + ! A.fontSize "0.57" + ! A.fontWeight "bold" + ! A.letterSpacing "0.05" + ! A.strokeLinejoin "round" + ! A.strokeLinecap "round"
+ src/Icons/Math.hs view
@@ -0,0 +1,102 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Math where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgMath :: [ (String , S.Svg) ] +>svgMath = +> [ (,) "lambda" lambda +> , (,) "lemniscate" lemniscate +> ] +-} +svgMath :: [ (String , S.Svg) ] +svgMath = + [ (,) "lambda" lambda + , (,) "lemniscate" lemniscate + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +lambda :: S.Svg +lambda = + S.g $ do + S.path + ! A.strokeLinejoin "round" + ! A.d (mkPath $ rightLeg >> leftLeg >> arm) + ! A.transform (translate 0 (-0.02)) + where + (c1,c2) = (,) ( 0 ) ( 0 ) + (a1,a2) = (,) (-0.376) ( 0.962) + (b1,b2) = (,) (-0.548) ( a2 ) + (d1,d2) = (,) ( 0.088) (-0.098) + leftLeg = do + S.l c1 c2 + S.l a1 a2 + S.l b1 b2 + S.l m1 m2 + (e1,e2) = (,) ( 0.226) ( 0.54 ) + (f1,f2) = (,) ( 0.326) ( 0.864) + (g1,g2) = (,) ( 0.610) ( 0.890) + (h1,h2) = (,) ( 0.652) ( 0.576) + (j1,j2) = (,) ( 0.710) ( 1.10 ) + (k1,k2) = (,) ( 0.234) ( j2 ) + (l1,l2) = (,) ( 0.142) ( 0.60 ) + (m1,m2) = (,) (-0.054) (-0.274) + rightLeg = do + S.m d1 d2 + S.l e1 e2 + S.c f1 f2 g1 g2 h1 h2 + S.c j1 j2 k1 k2 l1 l2 + (n1,n2) = (,) (-0.12 ) (-0.86 ) + (o1,o2) = (,) (-0.470) ( n2 ) + (p1,p2) = (,) (-0.550) (-0.502) + (r1,r2) = (,) (-0.570) (-1.06 ) + (s1,s2) = (,) (-0.142) ( r2 ) + (t1,t2) = (,) (-0.04 ) (-0.66 ) + arm = do + S.c n1 n2 o1 o2 p1 p2 + S.c r1 r2 s1 s2 t1 t2 + S.l d1 d2 + + + +{- | + + + +-} +lemniscate :: Svg +lemniscate = + S.path + ! A.d dirs + where + k = 0.5 + r = 0.4 + dirs = mkPath $ do + m (-k) (-r) + aa r r 0 True False (-k) ( r) + c 0 r 0 (-r) ( k) (-r) + aa r r 0 True True ( k) ( r) + c 0 r 0 (-r) (-k) (-r) + S.z
+ src/Icons/Office.hs view
@@ -0,0 +1,540 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Office where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgOffice :: [ (String , S.Svg) ] +>svgOffice = +> [ (,) "envelope" envelope +> , (,) "pencil" pencil +> , (,) "document" document +> , (,) "archive" archive +> , (,) "pin" pin +> , (,) "clip" paperclip +> , (,) "clipboard" clipboard +> , (,) "printer" printer +> , (,) "lupe" lupe +> , (,) "briefcase" briefcase +> ] +-} +svgOffice :: [ (String , S.Svg) ] +svgOffice = + [ (,) "envelope" envelope + , (,) "pencil" pencil + , (,) "document" document + , (,) "archive" archive + , (,) "pin" pin + , (,) "paperclip" paperclip + , (,) "clipboard" clipboard + , (,) "printer" printer + , (,) "lupe" lupe + , (,) "briefcase" briefcase + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +envelope :: Svg +envelope = + S.path + ! d dirs + ! strokeLinejoin "round" + where + kx = 0.94 + ky = 0.618 * kx + mx = 0 + my = 0 + s = 0.03 + dirs = mkPath $ do + m (-kx) (-ky) + l ( mx) ( my) + l ( kx) (-ky) + S.z + m (-kx) (-ky + s) + l (-kx) ( ky) + l ( kx) ( ky) + l ( kx) (-ky + s) + l ( mx) ( my + s) + S.z + + + +{- | + + + +-} +pencil :: Svg +pencil = + S.path + ! d pencilPath + ! strokeLinejoin "round" + where + w = 0.6 -- width of the pencil + x1 = -w/2 + x2 = w/2 + y1 = -0.9 + y2 = -0.76 + y3 = -0.6 + y4 = 0.4 + y5 = y6 - 0.15 + y6 = 0.94 + pencilPath = mkPath $ do + m 0 y5 + l 0 y6 + l x1 y4 + l x2 y4 + l 0 y6 + m x1 y4 + l x1 y3 + l x2 y3 + l x2 y4 + m 0 y4 + l 0 y3 + m x1 y3 + l x1 y2 + l x2 y2 + l x2 y3 + m x1 y2 + l x1 y1 + aa (w/2) 0.03 0 True True x2 y1 + l x2 y2 + + + +{- | + + + +-} +document :: Svg +document = + S.g $ do + paperBorder + S.path + ! strokeLinecap "round" + ! d lines + S.path + ! A.d xMark + ! fill "none" + ! strokeLinecap "round" + ! transform (translate (-0.25) 0.55 <> rotateAround 45 0 0) + pencil + ! transform (translate 0.55 0.35 <> rotateAround 45 0 0 <> S.scale 0.4 0.4) + where + py = 0.95 + px = 0.618 * py + paperBorder = + S.path + ! strokeLinejoin "round" + ! strokeLinecap "round" + ! fill "none" + ! d paperPath + paperPath = mkPath $ do + m ( px) (-0.16) + l ( px) (-py) + l (-px) (-py) + l (-px) ( py) + l ( px) ( py) + l ( px) ( 0.7) + -------------------------------------------------- + xl = 0.4 + y1 = -0.65 + y2 = -0.35 + y3 = -0.05 + lines = mkPath $ do + m (-xl) y1 >> l xl y1 + m (-xl) y2 >> l xl y2 + m (-xl) y3 >> l xl y3 + -------------------------------------------------- + m1 = 0.15 + xMark = mkPath $ do + m (-m1) 0 + l ( m1) 0 + m 0 (-m1) + l 0 ( m1) + + + +{- | + + + +-} +archive :: S.Svg +archive = + S.g $ do + S.path + ! A.strokeLinejoin "round" + ! A.d archiveBody + archiveHandle (-ky * 2/3) + archiveHandle 0 + archiveHandle ( ky * 2/3) + where + ky = 0.96 + kx = 0.75 + archiveBody = mkPath $ do + m (-kx) (-ky) + l (-kx) ( ky) + l ( kx) ( ky) + l ( kx) (-ky) + S.z + m (-kx) (-1/3 * ky) + l ( kx) (-1/3 * ky) + m (-kx) ( 1/3 * ky) + l ( kx) ( 1/3 * ky) + archiveHandle h = + S.path + ! A.fill "none" + ! A.strokeLinecap "round" + ! A.transform (translate 0 (hr/2)) + ! A.d (handleDirs h) + hx = 0.25 + hr = 0.07 + handleDirs h = mkPath $ do + m (-hx) (h - hr) + aa hr hr 0 False False (-hx + hr) (h) + l ( hx - hr) (h) + aa hr hr 0 False False ( hx) (h - hr) + + + +{- | + + + +-} +pin :: Svg +pin = + S.g $ + S.path + ! A.strokeLinejoin "arcs" + ! A.strokeMiterlimit "8" + ! A.d (mkPath $ topPath >> bodyPath >> needlePath) + ! A.transform (S.rotateAround 45 0 0) + where + w1 = 0.26 + w2 = 0.08 + y1 = -0.95 + y2 = -0.7 + y3 = -0.1 + y4 = 0.16 + y5 = 0.6 + y6 = 1.03 + r1 = (y2 - y1) / 2 + r2 = (y4 - y3) + topPath = do + m (-w1) y1 + aa r1 r1 0 True False (-w1) y2 + l ( w1) y2 + aa r1 r1 0 True False ( w1) y1 + l (-w1) y1 + bodyPath = do + m (-w1) y2 + l (-w1) y3 + aa r2 r2 0 False False (-w1 - r2) y4 + l ( w1 + r2) y4 + aa r2 r2 0 False False ( w1) y3 + l ( w1) y2 + needlePath = do + m (-w2) y4 + l (-w2) y5 + l 0 y6 + l ( w2) y5 + l ( w2) y4 + + + +{- | + + + +-} +paperclip :: Svg +paperclip = + S.g $ + S.path + ! A.d clipDirs + ! A.transform (rotateAround 45 0 0) + where + w = 0.07 + x1 = 0.2 + x2 = 0.44 + r1 = x1 + r2 = (x1 + x2) / 2 + r3 = x2 + y1 = 0.5 + y2 = -0.48 + y3 = 0.68 + y4 = -0.66 + clipDirs = mkPath $ do + m (-x1 - w) y1 + l (-x1 - w) y2 + aa ( r1 + w) ( r1 + w) 0 True True ( x1 + w) y2 + l ( x1 + w) y3 + aa ( r2 + w) ( r2 + w) 0 True True (-x2 - w) y3 + l (-x2 - w) y4 + aa ( r3 + w) ( r3 + w) 0 True True ( x2 + w) y4 + l ( x2 + w) y1 + aa ( w) ( w) 0 True True ( x2 - w) y1 + l ( x2 - w) y4 + aa ( r3 - w) ( r3 - w) 0 True False (-x2 + w) y4 + l (-x2 + w) y3 + aa ( r2 - w) ( r2 - w) 0 True False ( x1 - w) y3 + l ( x1 - w) y2 + aa ( r1 - w) ( r1 - w) 0 True False (-x1 + w) y2 + l (-x1 + w) y1 + aa ( w) ( w) 0 True True (-x1 - w) y1 + S.z + + + +{- | + + + +-} +clipboard :: Svg +clipboard = + S.g $ do + S.path + ! d boardDirs + S.path + ! d clipDirs + where + dx1 = 0.3 + dx2 = 0.7 + y1 = -0.9 + y2 = -0.7 + y3 = -0.5 + y4 = 0.9 + r1 = 0.2 + r2 = 0.24 + boardDirs = mkPath $ do + m (-dx1 ) (y2 ) + l (-dx2 + r2) (y2 ) + aa r2 r2 0 False False (-dx2 ) (y2 + r2) + l (-dx2 ) (y4 - r2) + aa r2 r2 0 False False (-dx2 + r2) (y4 ) + l ( dx2 - r2) (y4 ) + aa r2 r2 0 False False ( dx2 ) (y4 - r2) + l ( dx2 ) (y2 + r2) + aa r2 r2 0 False False ( dx2 - r2) (y2 ) + l ( dx1 ) (y2 ) + clipDirs = mkPath $ do + m (-dx1 ) (y2 ) + l (-dx1 ) (y3 ) + l ( dx1 ) (y3 ) + l ( dx1 ) (y1 + r1) + aa r1 r1 0 False False ( dx1 - r1) (y1 ) + l (-dx1 + r1) (y1 ) + aa r1 r1 0 False False (-dx1 ) (y1 + r1) + S.z + + + +{- | + + + +-} +printer :: Svg +printer = + S.g $ do + S.path + ! A.d topDirs + S.path + ! A.d midDirs + S.path + ! A.strokeLinecap "round" + ! A.d botDirs + dots + where + x0 = 0.5 + x1 = 0.9 + x2 = x0 - 0.1 + y0 = 0.4 + y1 = 0.8 + y2 = 0.2 + y3 = 0.94 + ky = (y3 - y2)/4 + r0 = 0.1 + dx = 0.3 + dy = -0.1 + dr = 0.09 + topDirs = mkPath $ do + m (-x0) (-y0) + l (-x0) (-y1) + l ( x0) (-y1) + l ( x0) (-y0) + midDirs = mkPath $ do + m (-x0) ( y0) + l (-x1 + r0) ( y0) + aa r0 r0 0 False True (-x1) ( y0 - r0) + l (-x1) (-y0 + r0) + aa r0 r0 0 False True (-x1 + r0) (-y0) + l ( x1 - r0) (-y0) + aa r0 r0 0 False True ( x1) (-y0 + r0) + l ( x1) ( y0 - r0) + aa r0 r0 0 False True ( x1 - r0) ( y0) + l ( x0) ( y0) + botDirs = mkPath $ do + m (-x0) y2 + l ( x0) y2 + l ( x0) y3 + l (-x0) y3 + S.z + m (-x2) (y2 + ky) + l ( x2) (y2 + ky) + m (-x2) (y2 + 2*ky) + l ( x2) (y2 + 2*ky) + m (-x2) (y2 + 3*ky) + l ( x2) (y2 + 3*ky) + dots = + do + S.circle + ! A.stroke "none" + ! (A.cx .: (-dx)) + ! (A.cy .: dy) + ! (A.r .: dr) + ! A.fill "hotpink" + S.circle + ! A.stroke "none" + ! (A.cx .: 0 ) + ! (A.cy .: dy) + ! (A.r .: dr) + ! A.fill "lime" + S.circle + ! A.stroke "none" + ! (A.cx .: dx) + ! (A.cy .: dy) + ! (A.r .: dr) + ! A.fill "deepskyblue" + + + +{- | + + + +-} +lupe :: S.Svg +lupe = + S.g $ do + S.path + ! A.d dirs + ! A.fillRule "evenodd" + ! A.transform (rotateAround 45 0 0) + where + w1 = 0.08 + w2 = 0.12 + r1 = 0.54 + r2 = r1 + 2*w1 + x1 = 0.07 + x2 = w2 + y1 = 0.3 + y2 = 0.6 + y3 = 1.12 + dirs = mkPath $ do + m 0 (y1 - w1) + aa r1 r1 0 True False (-0.01) ( y1 - w1) + S.z + m (-x1) (y1 + w1) + aa r2 r2 0 True True ( x1) ( y1 + w1) + q x2 (y2 - 0.18) x2 y2 + l x2 y3 + aa w2 w2 0 True True (-x2) ( y3) + l (-x2) y2 + q (-x2) (y2 - 0.18) (-x1) (y1 + w1) + S.z + + + +{- | + + + +-} +briefcase :: Svg +briefcase = + S.g $ do + S.path + ! A.strokeLinejoin "round" + ! A.d top + S.path + ! A.strokeLinejoin "round" + ! A.d bot + button + where + r1 = 0.2 + r2 = 0.07 + x1 = 0.94 + x2 = 0.46 + x3 = 0.3 + y1 = -0.86 + y2 = -0.7 + y3 = -0.54 + y4 = 0 + y5 = 0.06 + y6 = 0.8 + rx1 = 0.12 + ry1 = 0.18 + rx2 = 0.07 + ry2 = 0.135 + top = mkPath $ do + m x3 y3 + l x3 y2 + l (-x3) y2 + l (-x3) y3 + S.z + m (-x1) y4 + l (-x1) (y3 + r1) + aa r1 r1 0 False True (-x1 + r1) y3 + l (-x2) y3 + l (-x2) (y1 + r2) + aa r2 r2 0 False True (-x2 + r2) y1 + l ( x2 - r2) y1 + aa r2 r2 0 False True ( x2) (y1 + r2) + l x2 y3 + l ( x1 - r1) y3 + aa r1 r1 0 False True ( x1) (y3 + r1) + l x1 y4 + l rx1 y4 + aa rx1 ry1 0 False False (-rx1) y4 + S.z + bot = mkPath $ do + m (-x1) y5 + l (-x1) (y6 - r1) + aa r1 r1 0 False False (-x1 + r1) y6 + l ( x1 - r1) y6 + aa r1 r1 0 False False x1 (y6 - r1) + l x1 y5 + l rx1 y5 + aa rx1 ry1 0 False True (-rx1) y5 + S.z + button = + S.ellipse + ! (A.cx .: 0) + ! (A.cy .: (y5 + y4)/2) + ! (A.rx .: rx2) + ! (A.ry .: ry2)
+ src/Icons/Religion.hs view
@@ -0,0 +1,355 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Religion where + +import Data.String +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Geometry +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgReligion :: [ (String , S.Svg) ] +>svgReligion = +> [ (,) "xp" xp +> , (,) "taijitu" (taijitu "black" "white") +> , (,) "crossLatin" crossLatin +> , (,) "crossOrthodox" crossOrthodox +> , (,) "crescentAndStar" crescentAndStar +> , (,) "starOfDavid" starOfDavid +> , (,) "exampleHexagram" (iChingHexagram (8,8,7,8,7,7)) +> ] +-} +svgReligion :: [ (String , S.Svg) ] +svgReligion = + [ (,) "xp" xp + , (,) "taijitu" (taijitu "black" "white") + , (,) "crossLatin" crossLatin + , (,) "crossOrthodox" crossOrthodox + , (,) "crescentAndStar" crescentAndStar + , (,) "starOfDavid" starOfDavid + , (,) "exampleHexagram" (iChingHexagram (8,8,7,8,7,7)) + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +xp :: Svg +xp = + S.g $ do + S.path + ! A.d rho + ! A.fillRule "evenodd" + S.path + ! A.d chi + ! A.transform (rotateAround 45 0 0) + S.path + ! A.d alpha + ! A.fill "none" + ! A.strokeLinecap "round" + ! A.strokeLinejoin "round" + S.path + ! A.d omega + ! A.fill "none" + ! A.strokeLinecap "round" + ! A.strokeLinejoin "round" + where + w = 0.07 + k1 = 0.5 + k2 = 0.96 + k3 = 0.17 + r1 = 0.2 + a = 0.3 + chi = mkPath $ do + m ( -w) ( -w) + l ( -w) (-k1+w) + q ( -w) (-k1 ) ( -2*w) (-k1 ) + l ( 2*w) (-k1 ) + q ( w) (-k1 ) ( w) (-k1+w) + l ( w) ( -w) + l ( k1-w) ( -w) + q ( k1 ) ( -w) ( k1 ) ( -2*w) + l ( k1 ) ( 2*w) + q ( k1 ) ( w) ( k1-w) ( w) + l ( w) ( w) + l ( w) ( k1-w) + q ( w) ( k1 ) ( 2*w) ( k1 ) + l ( -2*w) ( k1 ) + q ( -w) ( k1 ) ( -w) ( k1-w) + l ( -w) ( w) + l (-k1+w) ( w) + q (-k1 ) ( w) (-k1 ) ( 2*w) + l (-k1 ) ( -2*w) + q (-k1 ) ( -w) (-k1+w) ( -w) + S.z + rho = mkPath $ do + m ( w) (-k2 ) + l ( -2*w) (-k2 ) + q ( -w) (-k2 ) ( -w) (-k2+w) + l ( -w) ( k2-w) + q ( -w) ( k2 ) ( -2*w) ( k2) + l ( 2*w) ( k2 ) + q ( w) ( k2 ) ( w) ( k2-w) + l ( w) (-k2+2*r1) + l ( k3+w) (-k2+2*r1) + aa r1 r1 0 True False ( k3+w) (-k2) + S.z + m ( w) (-k2+2*r1 - w) + c (2*k3+w) (-k2+2*r1) (2*k3+w) (-k2) ( w) (-k2 + w) + S.z + alpha = mkPath $ do + m (-0.7-a/2) ( a/2) + l (-0.7 ) (-a/2) + l (-0.7+a/2) ( a/2) + m (-0.7-a/4) ( 0 ) + l (-0.7 ) ( a/4) + l (-0.7+a/4) ( 0 ) + omega = mkPath $ do + m ( 0.7-a/2) ( a/2) + l ( 0.7-a/5) ( a/2) + aa (a/2) (a/2) 0 True True (0.7+a/5) (a/2) + l ( 0.7+a/2) ( a/2) + + + +{- | + + + + +You must provide both yin and yang colors +-} +taijitu :: String -> String -> Svg +taijitu yinColor yangColor = + S.g $ do + outerCircle + yin + yangDot + yinDot + where + r1 = 0.92 + r1m = 0.5 * r1 + r2 = r1 / 6 + outerCircle = + S.circle + ! (A.cx .: 0) + ! (A.cy .: 0) + ! (A.r .: r1) + ! A.fill (S.toValue yangColor) + yin = + S.path + ! A.fill (S.toValue yinColor) + ! A.d yinDirs + yinDirs = mkPath $ do + m ( -r1) 0 + aa r1m r1m 0 True False 0 0 + aa r1m r1m 0 True True ( r1) 0 + aa r1 r1 0 True True (-r1) 0 + S.z + yangDot = + S.circle + ! (A.cx .: 0 + r1m) + ! (A.cy .: 0 ) + ! (A.r .: r2) + ! A.stroke "none" + ! A.fill (S.toValue yangColor) + yinDot = + S.circle + ! (A.cx .: 0 - r1m) + ! (A.cy .: 0 ) + ! (A.r .: r2) + ! A.stroke "none" + ! A.fill (S.toValue yinColor) + + + +{- | + + + +-} +crossLatin :: Svg +crossLatin = + S.path + ! A.d dirs + where + w = 0.1 + k1 = 0.9 + k2 = k1 * 3/4 + km = -k1 + k1 * 2/3 + dirs = mkPath $ do + m (-w ) (-k1 ) + l (-w ) ( km - w) + l (-k2) ( km - w) + l (-k2) ( km + w) + l (-w ) ( km + w) + l (-w ) ( k1 ) + l ( w ) ( k1 ) + l ( w ) ( km + w) + l ( k2) ( km + w) + l ( k2) ( km - w) + l ( w ) ( km - w) + l ( w ) (-k1 ) + S.z + + + +{- | + + + +-} +crossOrthodox :: Svg +crossOrthodox = + S.path + ! A.d dirs + where + w = 0.1 + y1 = -0.84 + y2 = y1 + 2*w + y3 = y1 + 6*w + y4 = 0.6 + y5 = -y1 + x1 = (y1 + w) * 0.618 - w + x2 = x1 / 2 + x3 = 0 + x4 = x5 / 2 + x5 = -x1 + α = pi / 3 + ct = 1 / tan α + dirs = mkPath $ do + m (x3 - w) (y3 + w) + l (x1 - w) (y3 + w) + l (x1 - w) (y3 - w) + l (x3 - w) (y3 - w) + l (x3 - w) (y2 + w) + l (x2 - w) (y2 + w) + l (x2 - w) (y2 - w) + l (x3 - w) (y2 - w) + l (x3 - w) (y1 - w) + l (x3 + w) (y1 - w) + l (x3 + w) (y2 - w) + l (x4 + w) (y2 - w) + l (x4 + w) (y2 + w) + l (x3 + w) (y2 + w) + l (x3 + w) (y3 - w) + l (x5 + w) (y3 - w) + l (x5 + w) (y3 + w) + l (x3 + w) (y3 + w) + l (x3 + w) (y4 - w + w * ct) + l (x4 + w) (y4 - w + (x4 + w) * ct) + l (x4 + w) (y4 + w + (x4 + w) * ct) + l (x3 + w) (y4 + w + w * ct) + l (x3 + w) (y5 + w) + l (x3 - w) (y5 + w) + l (x3 - w) (y4 + w - w * ct) + l (x2 - w) (y4 + w - (x4 + w) * ct) + l (x2 - w) (y4 - w - (x4 + w) * ct) + l (x3 - w) (y4 - w - w * ct) + S.z + + + +{- | + + + +-} +crescentAndStar :: Svg +crescentAndStar = + S.g $ do + S.path + ! A.strokeLinejoin "round" + ! A.d moonDirs + starRegular 5 0.3 (0.55, 0.05) + where + kx = 0.55 + ky = 0.55 + r1 = 0.8 + r2 = 0.65 + moonDirs = mkPath $ do + m ( kx) (-ky) + aa r1 r1 0 True False ( kx) ( ky) + aa r2 r2 0 True True ( kx) (-ky) + S.z + + + +{- | + + + +-} +starOfDavid :: Svg +starOfDavid = + starPolygonFirstSpecies 6 0.9 (0,0) + + + +{- | + + + + +Function to draw a hexagram from the Yi Ching (the Book of Mutations). +If all six numbers belong to {0,1} it draws only the hexagram lines. +Otherwise, the numbers are printed right to their line +-} +iChingHexagram :: (Int,Int,Int,Int,Int,Int) -> Svg +iChingHexagram (n1,n2,n3,n4,n5,n6) = + S.g $ do + S.path + ! A.d lines + if doNotPrintNumbers + then mempty + else numbers + where + doNotPrintNumbers = + (\k -> k == 0 || k == 1) `all` [n1,n2,n3,n4,n5,n6] + x1 = 0.7 + x2 = 0.1 + ky = 2 / 14 + line k y = + if (odd k) + then m (-x1) y >> l x1 y + else m (-x1) y >> l (-x2) y >> m x2 y >> l x1 y + lines = mkPath $ do + line n6 (-5*ky) + line n5 (-3*ky) + line n4 (-1*ky) + line n3 ( 1*ky) + line n2 ( 3*ky) + line n1 ( 5*ky) + number k y = + S.text_ (fromString $ show k) + ! (A.x .: 0.85) + ! (A.y .: y) + ! A.dominantBaseline "central" + ! A.textAnchor "middle" + ! A.fontFamily "Times New Roman, serif" + ! A.fontSize "0.2" + ! A.strokeWidth "0" + numbers = + S.g $ do + number n6 (-5*ky) + number n5 (-3*ky) + number n4 (-1*ky) + number n3 ( 1*ky) + number n2 ( 3*ky) + number n1 ( 5*ky)
+ src/Icons/Textarea.hs view
@@ -0,0 +1,633 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Textarea where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + +{- | +A list with all the icons of this module, +together with appropriate names. +This module contains icons suitable for the +tool bars of a text editor (bold, italic, etc.) + +>svgTextarea :: [ (String , S.Svg) ] +>svgTextarea = +> [ (,) "bold" bold +> , (,) "italic" italic +> , (,) "link" link +> , (,) "image" imageIcon +> , (,) "video" video +> , (,) "bulletList" bulletList +> , (,) "numberList" numberList +> , (,) "header" header +> , (,) "hr" horizontalRule +> , (,) "undo" undo +> , (,) "redo" redo +> , (,) "help" questionMark +> , (,) "fullscreen" fullscreen +> , (,) "preview" preview +> ] +-} +svgTextarea :: [ (String , S.Svg) ] +svgTextarea = + [ (,) "bold" bold + , (,) "italic" italic + , (,) "link" link + , (,) "image" imageIcon + , (,) "video" video + , (,) "bulletList" bulletList + , (,) "numberList" numberList + , (,) "header" header + , (,) "hr" horizontalRule + , (,) "undo" undo + , (,) "redo" redo + , (,) "help" questionMark + , (,) "fullscreen" fullscreen + , (,) "preview" preview + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +bold :: S.Svg +bold = + S.path + ! d dirs + where + k0 = 0.2 + k1 = (-0.15) + k2 = 0.42 + k3 = 2 * k2 + k6 = 0.2 + dirs = mkPath $ do + m (-1 + k0) (-1 + k0) + l k1 (-1 + k0) + l k1 (-1 + k0) + l k6 (-1 + k0) + aa 0.25 0.25 0 True True k6 0 + l (k6 + 0.1) 0 + aa 0.4 0.35 0 True True (k6 + 0.1) (1 - k0) + l k1 ( 1 - k0) + l (-1 + k0) ( 1 - k0) + l (-1 + k0) ( 1 - k2) + q (-1 + k2) ( 1 - k2) (-1 + k2) ( 1 - k3) + l (-1 + k2) (-1 + k3) + q (-1 + k2) (-1 + k2) (-1 + k0) (-1 + k2) + l (-1 + k0) (-1 + k0) + S.z + m k1 (-(1 - k0)/2 + 0.15) + aa 0.22 0.22 0 True False k1 (-(1 - k0)/2 - 0.15) + S.z + m k1 0.55 + l (k6 - 0.1) 0.55 + aa 0.20 0.15 0 True False (k6 - 0.1) 0.2 + l k1 0.2 + S.z + + + +{- | + + + +-} +italic :: S.Svg +italic = + S.path + ! d dirs + where + k1 = 0.12 -- half width of the line + k2 = 1 -- length of the horizontal lines + k3 = 0.2 -- distance from the center of the horizontal lines to y-axis + k4 = 0.65 -- distance from the center of the horizontal lines to x-axis + x1 = -k3 - 0.5 * k2 + x1' = -k3 - k1 + x2' = -k3 + k1 + x2 = -k3 + 0.5 * k2 + x3 = k3 - 0.5 * k2 + x3' = k3 - k1 + x4' = k3 + k1 + x4 = k3 + 0.5 * k2 + y1 = k4 + k1 + y2 = k4 - k1 + y3 = -k4 + k1 + y4 = -k4 - k1 + dirs = mkPath $ do + m x1 y1 + l x2 y1 + aa k1 k1 0 True False x2 y2 + l x2' y2 + l x4' y3 + l x4 y3 + aa k1 k1 0 True False x4 y4 + l x3 y4 + aa k1 k1 0 True False x3 y3 + l x3' y3 + l x1' y2 + l x1 y2 + aa k1 k1 0 True False x1 y1 + S.z + + + +{- | + + + +-} +link :: S.Svg +link = + g $ do + topPart ! A.transform (rotateAround 45 0 0) + topPart ! A.transform (rotateAround 45 0 0 <> rotateAround 180 0 0) + where + topPart = S.path ! d topPath + ----------------- + w1 = 0.4 + w2 = 0.24 + ----------------- + h1 = 1 - w2 + h2 = 0.4 + h3 = 0.3 + h4 = h3 - (w1 - w2) + topPath = mkPath $ do + m (-w1) (-h3) + l (-w1) (-h1) + aa w1 w1 0 True True ( w1) (-h1) + l ( w1) (-h4) + aa w1 w1 0 False True 0 ( h3) + aa ((h3 - h4)/2) ((h3 - h4)/2) 0 False True 0 ( h4) + aa w2 w2 0 False False ( w2) (-h4) + l ( w2) (-h1) + aa w2 w2 0 True False (-w2) (-h1) + l (-w2) (-h2) + S.z + + + +{- | + + + +-} +imageIcon :: S.Svg +imageIcon = + S.g $ do + sun + mountain + imageFrameStroked + imageFrameFilled + where + sun = + circle + ! (cx .: 0.5) + ! (cy .: (-0.5)) + ! (r .: 0.24) + ------------------------- + x = 0.09 + imageFrameFilled = + S.path + ! d framePath1 + ! A.stroke "none" + framePath1 = mkPath $ do + m (-1) (-1) + l 1 (-1) + l 1 1 + l (-1) 1 + S.z + m (-1 + x) (-1 + x) + l (-1 + x) ( 1 - x) + l ( 1 - x) ( 1 - x) + l ( 1 - x) (-1 + x) + S.z + imageFrameStroked = + S.path + ! A.fill "none" + ! d framePath2 + framePath2 = mkPath $ do + m (-0.94) (-0.94) + l 0.94 (-0.94) + l 0.94 0.94 + l (-0.94) 0.94 + S.z + ------------------------- + mountain = + S.path + ! A.d mountainPath + mountainPath = mkPath $ do + m (-0.92) 0.92 + l (-0.35) (-0.35) + l 0 0.55 + l 0.45 0.2 + l 0.92 0.92 + S.z + + + +{- | + + + +-} +video :: S.Svg +video = + S.path ! A.d boxPath + where + h = 1.2 + w = 1.618 * h + y1 = -0.5 * h + y2 = 0.5 * h + x1 = -0.5 * w + x2 = 0.5 * w + tx = 0.16 + th = 3 * tx + boxPath = mkPath $ do + m x1 0 + c x1 (y1 + 0.1 ) x1 (y1 + 0 ) 0 y1 + c x2 (y1 + 0.0 ) x2 (y1 + 0.1) x2 0 + c x2 (y2 - 0.1 ) x2 (y2 + 0 ) 0 y2 + c x1 (y2 + 0.0 ) x1 (y2 - 0.1) x1 0 + S.z + m (0 - tx) (0 - th/2) + l (0 - tx) (0 + th/2) + l (2*th/3) 0 + S.z + + + +{- | +Helper for both list icons +-} +horizontalBars :: S.Svg +horizontalBars = + S.g $ do + S.path ! d topLine + S.path ! d midLine + S.path ! d botLine + where + w = 0.20 + x1 = -0.4 + x2 = 0.92 + y1 = -0.6 + y2 = 0 + y3 = 0.6 + topLine = mkPath $ do + m x1 (y1 - w/2) + l x2 (y1 - w/2) + l x2 (y1 + w/2) + l x1 (y1 + w/2) + S.z + midLine = mkPath $ do + m x1 (y2 - w/2) + l x2 (y2 - w/2) + l x2 (y2 + w/2) + l x1 (y2 + w/2) + S.z + botLine = mkPath $ do + m x1 (y3 - w/2) + l x2 (y3 - w/2) + l x2 (y3 + w/2) + l x1 (y3 + w/2) + S.z + + + +{- | + + + +-} +bulletList :: S.Svg +bulletList = + S.g $ do + horizontalBars + bullets + where + radius = 0.12 + x1 = -0.75 + y1 = -0.6 + y2 = 0 + y3 = 0.6 + bullets = S.g $ do + circle ! (cx .: x1) ! (cy .: y1) ! (r .: radius) + circle ! (cx .: x1) ! (cy .: y2) ! (r .: radius) + circle ! (cx .: x1) ! (cy .: y3) ! (r .: radius) + + + +{- | + + + +-} +numberList :: Svg +numberList = + S.g $ do + horizontalBars + numbers + where + x1 = -0.75 + y1 = -0.6 + y2 = 0 + y3 = 0.6 + number k h = + S.text_ k + ! dominantBaseline "central" + ! textAnchor "middle" + ! fontFamily "monospace" + ! fontWeight "bold" + ! fontSize "0.5" + ! (A.x .: x1) + ! (A.y .: h) + numbers = + S.g $ do + number "1" y1 + number "2" y2 + number "3" y3 + + + +{- | + + + +-} +header :: S.Svg +header = + S.g $ do + S.path ! d line1 + S.path ! d line2 + S.path ! d line3 ! opacity "0.4" + S.path ! d line4 ! opacity "0.4" + S.path ! d line5 ! opacity "0.4" + where + l1 = -0.9 + l2 = -0.5 + r2 = 0.5 + r1 = 0.9 + h = 2/6 + w = 0.2 + line1 = mkPath $ do + m l1 (-2*h - w/2) + l r1 (-2*h - w/2) + l r1 (-2*h + w/2) + l l1 (-2*h + w/2) + S.z + line2 = mkPath $ do + m l2 (-1*h - w/2) + l r2 (-1*h - w/2) + l r2 (-1*h + w/2) + l l2 (-1*h + w/2) + S.z + line3 = mkPath $ do + m l1 ( 0 - w/2) + l r1 ( 0 - w/2) + l r1 ( 0 + w/2) + l l1 ( 0 + w/2) + S.z + line4 = mkPath $ do + m l2 ( 1*h - w/2) + l r2 ( 1*h - w/2) + l r2 ( 1*h + w/2) + l l2 ( 1*h + w/2) + S.z + line5 = mkPath $ do + m l1 ( 2*h - w/2) + l r1 ( 2*h - w/2) + l r1 ( 2*h + w/2) + l l1 ( 2*h + w/2) + S.z + + + +{- | + + + +-} +horizontalRule :: S.Svg +horizontalRule = + S.g $ do + S.path ! d line1 ! opacity "0.4" + S.path ! d line2 ! opacity "0.4" + line3 + S.path ! d line4 ! opacity "0.4" + S.path ! d line5 ! opacity "0.4" + where + l1 = -0.9 + l2 = -0.5 + r2 = 0.5 + r1 = 0.9 + h = 2/6 + w = 0.2 + line1 = mkPath $ do + m l1 (-2*h - w/2) + l r1 (-2*h - w/2) + l r1 (-2*h + w/2) + l l1 (-2*h + w/2) + S.z + line2 = mkPath $ do + m l2 (-1*h - w/2) + l r2 (-1*h - w/2) + l r2 (-1*h + w/2) + l l2 (-1*h + w/2) + S.z + square leftX = + S.rect + ! (A.x .: leftX) + ! (A.y .: 0 - w/2) + ! (width .: w) + ! (height .: w) + line3 = do + square l1 + square l2 + square ( 0 - w/2) + square (r2 - w) + square (r1 - w) + line4 = mkPath $ do + m l2 ( 1*h - w/2) + l r2 ( 1*h - w/2) + l r2 ( 1*h + w/2) + l l2 ( 1*h + w/2) + S.z + line5 = mkPath $ do + m l1 ( 2*h - w/2) + l r1 ( 2*h - w/2) + l r1 ( 2*h + w/2) + l l1 ( 2*h + w/2) + S.z + + + +{- | + + + +-} +undo :: S.Svg +undo = + curvyArrowLeft + ! A.transform (translate 0 0.1) + + + +{- | + + + +-} +redo :: S.Svg +redo = + curvyArrowLeft + ! A.transform (translate 0 0.1 <> horizontalMirrorMatrix) + + + +{- | +Helper for both undo and redo icons +-} +curvyArrowLeft :: S.Svg +curvyArrowLeft = + S.path + ! d dirs + ! strokeLinejoin "round" + where + r1 = 0.5 + r2 = 0.66 + rm = (r2 - r1) + k1 = 0.24 + k2 = k1 + rm/2 + dirs = mkPath $ do + m (-r1) 0 + aa (rm/2) (rm/2) 0 False False (-r2) 0 + aa r2 r2 0 True False 0 (-r2) + lr k1 (-k1) + lr (-rm) 0 + lr (-k2) k2 + lr k2 k2 + lr rm 0 + lr (-k1) (-k1) + aa r1 r1 0 True True (-r1) 0 + S.z + + + +{- | + + + +-} +questionMark :: S.Svg +questionMark = + S.path + ! A.d dirs + ! A.transform (translate 0 (-0.35)) + where + r1 = 0.3 + r2 = 0.5 + rm = r2 - r1 + dirs = mkPath $ do + m (-r1) 0 + aa ( rm/2) (rm/2) 0 True True (-r2) 0 + aa ( r2) (r2) 0 True True ( r2) 0 + c ( r2) (r2 - 0.17) (rm/2) (r2 - 0.2) (rm/2) 0.5 + l ( rm/2) 0.75 + aa ( rm/2) (rm/2) 0 True True (-rm/2) 0.75 + l (-rm/2) 0.5 + c (-rm/2) (r1 - 0.15) (r1) (r1 - 0.1) (r1) 0 + aa ( r1) (r1) 0 True False (-r1) 0 + S.z + m (-0.01) 1 + aa ( rm/2) (rm/2) 0 True False 0.01 1 + S.z + + + +{- | + + + +-} +fullscreen :: S.Svg +fullscreen = + S.g $ do + corner + corner ! A.transform (rotateAround 90 0 0) + corner ! A.transform (rotateAround 180 0 0) + corner ! A.transform (rotateAround 270 0 0) + where + k1 = 0.9 + k2 = 0.7 + k3 = 0.3 + km = k1 - k2 + corner = + S.path + ! d dirs + ! strokeLinejoin "round" + dirs = mkPath $ do + m k1 k1 + l k3 k1 + aa (km/2) (km/2) 0 True True k3 k2 + l k2 k2 + l k2 k3 + aa (km/2) (km/2) 0 True True k1 k3 + S.z + + + +{- | + + + +-} +preview :: S.Svg +preview = + S.g $ do + lines + rectangle + where + kx = 0.2 + ky = 0.4 + w = 0.16 + lines = + S.g $ do + line (-2 * ky) + line (-1 * ky) + line ( 0 * ky) + line ( 1 * ky) + line ( 2 * ky) + line y = + S.path + ! fill "none" + ! d (lineDirs y) + lineDirs y = mkPath $ do + m (-1 + kx) (y - w/2) + aa (w/2) (w/2) 0 True False (-1 + kx) (y + w/2) + l ( 0 ) (y + w/2) + aa (w/2) (w/2) 0 True False ( 0 ) (y - w/2) + S.z + rectangle = + S.path + ! strokeLinejoin "round" + ! transform (translate 0.1 0) + ! d rectDirs + rectDirs = mkPath $ do + m (0 + kx) (-2 * ky - w/2) + l (1 - kx) (-2 * ky - w/2) + l (1 - kx) ( 2 * ky + w/2) + l (0 + kx) ( 2 * ky + w/2) + S.z
+ src/Icons/Tools.hs view
@@ -0,0 +1,218 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Icons.Tools where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Utils + + + +{- | +A list with all the icons of this module, +together with appropriate names. + +>svgTools :: [ (String , S.Svg) ] +>svgTools = +> [ (,) "lock" lock +> , (,) "key" key +> , (,) "keyWithArc" keyWithArc +> , (,) "cog6" cog6 +> , (,) "cog9" cog9 +> ] +-} +svgTools :: [ (String , S.Svg) ] +svgTools = + [ (,) "lock" lock + , (,) "key" key + , (,) "keyWithArc" keyWithArc + , (,) "cog6" cog6 + , (,) "cog9" cog9 + ] + + +-------------------------------------------------------------------------------- + + + +{- | + + + +-} +lock :: S.Svg +lock = + S.g $ do + S.path + ! A.d arm + S.path + ! fillRule "evenodd" + ! A.d body + where + aw = 0.07 + ax = 0.4 + ay1 = -0.1 + ay2 = -0.48 + arm = + mkPath $ do + m (-ax - aw) ay1 + l (-ax - aw) ay2 + aa ( ax + aw) (ax + aw) 0 True True ( ax + aw) ay2 + l ( ax + aw) ay1 + l ( ax - aw) ay1 + l ( ax - aw) ay2 + aa ( ax - aw) (ax - aw) 0 True False (-ax + aw) ay2 + l (-ax + aw) ay1 + S.z + ---------------------------------------- + bx = 0.7 + by1 = ay1 + by2 = 0.95 + kr = 0.14 + kw = 0.076 + ky1 = 0.4 + ky2 = 0.68 + body = mkPath $ do + m (-bx) by1 + l (-bx) by2 + l ( bx) by2 + l ( bx) by1 + S.z + m (-kw) ky1 + l (-kw) ky2 + aa kw kw 0 True False ( kw) ky2 + l ( kw) ky1 + aa kr kr 0 True False (-kw) ky1 + S.z + + + +{- | + + + +-} +key :: S.Svg +key = + S.path + ! fillRule "evenodd" + ! A.d keyPath + where + w = 0.1 + x0 = 0.3 + x1 = 0 + x2 = 0.5 + x3 = 0.8 + y1 = 0.3 + r1 = 0.25 + keyPath = mkPath $ do + m (x1-2*w) (-0.005) + aa r1 r1 0 True False (x1-2*w) 0 + S.z + m x1 (-w) + aa (r1+2*w) (r1+2*w) 0 True False x1 w + l (x2 - w) ( w) + l (x2 - w) (y1) + aa ( w) ( w) 0 True False (x2 + w) y1 + l (x2 + w) ( w) + l (x3 - w) ( w) + l (x3 - w) (y1) + aa ( w) ( w) 0 True False (x3 + w) y1 + l (x3 + w) (-w) + S.z + + + +{- | + + + +-} +keyWithArc :: S.Svg +keyWithArc = + S.g $ do + key ! A.transform (translate (-0.4) 0 <> S.scale 0.6 0.6) + arc ! A.transform (S.scale 0.6 0.6) + where + w = 0.1 + r1 = 1.3 + r2 = r1 + 2*w + π = pi + α = π / 4 + x1 = r1 * cos α + y1 = r1 * sin α + x2 = r2 * cos α + y2 = r2 * sin α + arc = + S.path + ! A.d arcPath + arcPath = mkPath $ do + m (-x1) (-y1) + aa w w 0 True True (-x2) (-y2) + aa r2 r2 0 True True (-x2) ( y2) + aa w w 0 True True (-x1) ( y1) + aa r1 r1 0 True False (-x1) (-y1) + S.z + + + +{- | + + + + + + + + +Takes a natural number @n@ which is the number of cogs, +and a real number @eps@ which controls how 'pointy' the cogs are. +-} +cogwheel :: Int -> Float -> S.Svg +cogwheel n eps = + S.path + ! A.d cogPath + where + r1 = 0.4 :: Float + r2 = 0.66 :: Float + r3 = 0.94 :: Float + a = (2 * pi) / (2 * fromIntegral n) + makeAngles k' = + let k = fromIntegral k' + in [ k*a - eps, k*a + eps ] + makePoint r α = ( r * cos α , r * sin α) + outer = map (makePoint r3) $ concatMap makeAngles $ filter even [0 .. 2*n] + inner = map (makePoint r2) $ concatMap makeAngles $ filter odd [0 .. 2*n] + f ((a1,a2):(b1,b2):outs) ((c1,c2):(d1,d2):ins) = do + l a1 a2 + l b1 b2 + l c1 c2 + aa r2 r2 0 False True d1 d2 + f outs ins + f _ _ = S.z + cogPath = mkPath $ do + m ( r1) 0 + aa r1 r1 0 True False (-r1) 0 + aa r1 r1 0 True False ( r1) 0 + m (fst $ head outer) (snd $ head outer) + f outer inner + + + +{- | +prop> cog6 = cogwheel 6 0.18 +-} +cog6 :: S.Svg +cog6 = cogwheel 6 0.18 + + + +{- | +prop> cog = cogwheel 9 0.12 +-} +cog9 :: S.Svg +cog9 = cogwheel 9 0.12
+ src/Images/Flags.hs view
@@ -0,0 +1,1483 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Images.Flags where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Geometry +import Core.Utils +import Images.FlagsCoA + + + +flags :: [ (String , S.Svg) ] +flags = + [ (,) "ad" ad + , (,) "af" af + , (,) "al" al + , (,) "at" at + , (,) "ba" ba + , (,) "be" be + , (,) "bg" bg + , (,) "by" blr + , (,) "ch" ch + , (,) "cy" cyp + , (,) "cz" cz + , (,) "de" de + , (,) "dk" dk + , (,) "ee" ee + , (,) "es" es + , (,) "eu" eu + , (,) "fi" fi + , (,) "fr" fr + , (,) "gr" gr + , (,) "hr" hrv + , (,) "ie" ie + , (,) "is" is + , (,) "it" it + , (,) "li" li + , (,) "lt" lt + , (,) "lu" lu + , (,) "lv" lv + , (,) "mc" mc + , (,) "md" md + , (,) "me" me + , (,) "mk" mk + , (,) "mt" mt + , (,) "nl" nl + , (,) "no" no + , (,) "pl" pl + , (,) "pt" pt + , (,) "ro" ro + , (,) "rs" rs + , (,) "ru" ru + , (,) "se" se + , (,) "si" si + , (,) "sk" sk + , (,) "sm" sm + , (,) "ua" ua + , (,) "uk" uk + , (,) "va" va + , (,) "xk" xk + ] + + +flagV3Eq :: (Float,Float) -> String -> String -> String -> Svg +flagV3Eq (w,h) c1 c2 c3 = + S.svg + ! A.viewbox (S.toValue $ "0 0 " ++ show w ++ " " ++ show h) + ! (A.width .: 100*w) + ! (A.height .: 100*h) + $ do + leftStripe + centralStripe + rightStripe + where + leftStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: w/3) + ! (A.height .: h) + ! A.stroke "none" + ! A.fill (S.toValue c1) + centralStripe = + S.rect + ! (A.x .: w/3) + ! (A.y .: 0) + ! (A.width .: w/3) + ! (A.height .: h) + ! A.stroke "none" + ! A.fill (S.toValue c2) + rightStripe = + S.rect + ! (A.x .: 2*w/3) + ! (A.y .: 0) + ! (A.width .: w/3) + ! (A.height .: h) + ! A.stroke "none" + ! A.fill (S.toValue c3) + + +flagH3Eq :: (Float,Float) -> String -> String -> String -> Svg +flagH3Eq (w,h) c1 c2 c3 = + S.svg + ! A.viewbox (S.toValue $ "0 0 " ++ show w ++ " " ++ show h) + ! (A.width .: 100*w) + ! (A.height .: 100*h) + $ do + topStripe + midStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: w) + ! (A.height .: h/3) + ! A.stroke "none" + ! A.fill (S.toValue c1) + midStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: h/3) + ! (A.width .: w) + ! (A.height .: h/3) + ! A.stroke "none" + ! A.fill (S.toValue c2) + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 2*h/3) + ! (A.width .: w) + ! (A.height .: h/3) + ! A.stroke "none" + ! A.fill (S.toValue c3) + + +-------------------------------------------------------------------------------- + +-- flag of Andorra +ad :: Svg +ad = + S.svg + ! A.viewbox "0 0 20 14" + ! A.width "200px" + ! A.height "140px" + $ do + leftStripe + centreStripe + rightStripe + where + leftStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 6.4) + ! (A.height .: 14) + ! A.stroke "none" + ! A.fill "#10069F" + centreStripe = + S.rect + ! (A.x .: 6.4) + ! (A.y .: 0) + ! (A.width .: 7.2) + ! (A.height .: 14) + ! A.stroke "none" + ! A.fill "#FEDD00" + rightStripe = + S.rect + ! (A.x .: 13.6) + ! (A.y .: 0) + ! (A.width .: 6.4) + ! (A.height .: 14) + ! A.stroke "none" + ! A.fill "#D50032" + + +-- flag of Afghanistan +af :: Svg +af = + flagV3Eq + (3,2) + "rgb(0,0,0)" + "rgb(190,0,0)" + "rgb(0,122,54)" + + +-- flag of Albania +al :: Svg +al = + S.svg + ! A.viewbox "0 0 980 700" + ! A.width "490px" + ! A.height "350px" + $ do + background + alCoA + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 980) + ! (A.height .: 700) + ! A.stroke "none" + ! A.fill "#FF0000" + + +-- flag of Austria +at :: Svg +at = + flagH3Eq + (3,2) + "#C8102E" + "#FFFFFF" + "#C8102E" + + +-- flag of Bosnia and Herzegovina +ba :: Svg +ba = + S.svg + ! A.viewbox "0 0 400 200" + ! A.width "400px" + ! A.height "200px" + $ do + defs $ + starDef + background + triangle + S.g $ do + star + star ! A.transform (translate 25 25) + star ! A.transform (translate 50 50) + star ! A.transform (translate 75 75) + star ! A.transform (translate 100 100) + star ! A.transform (translate 125 125) + star ! A.transform (translate 150 150) + star ! A.transform (translate 175 175) + star ! A.transform (translate 200 200) + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 400) + ! (A.height .: 200) + ! A.stroke "none" + ! A.fill "#001489" + triangle = + S.path + ! A.fill "#FFCD00" + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.d triangleDirs + triangleDirs = mkPath $ do + m 106 0 + l 306 0 + l 306 200 + S.z + a = (19 * (sqrt 5) - 38) / 2 + starDef = + starRegular 5 19 (68,-a) + ! A.fill "#FFFFFF" + ! A.strokeWidth "0" + ! A.id_ "HaskellSvgIcons-baFlagStar" + star = + S.use + ! A.fill "#FFFFFF" + ! A.xlinkHref "#HaskellSvgIcons-baFlagStar" + + +-- flag of Belgium +be :: Svg +be = + flagV3Eq + (3,2.6) + "#000000" + "#FFE936" + "#FF0F21" + + +-- flag of Bulgaria +bg :: Svg +bg = + flagH3Eq + (5,3) + "#FFFFFF" + "#009B74" + "#D01C1F" + + +-- flag of Belarus +blr :: Svg +blr = + S.svg + ! A.viewbox "0 0 90 45" + ! A.width "400px" + ! A.height "200px" + $ do + topStripe + botStripe + whiteStripe + ruchnik + where + topStripe = + S.rect + ! (A.x .: 10) + ! (A.y .: 0) + ! (A.width .: 80) + ! (A.height .: 30) + ! A.stroke "none" + ! A.fill "#CF101A" + botStripe = + S.rect + ! (A.x .: 10) + ! (A.y .: 30) + ! (A.width .: 80) + ! (A.height .: 15) + ! A.stroke "none" + ! A.fill "#007D2C" + whiteStripe = + S.rect + ! (A.x .: 1) + ! (A.y .: 0) + ! (A.width .: 9) + ! (A.height .: 45) + ! A.stroke "none" + ! A.fill "#FFFFFF" + ruchnikMatrix = + [ [0,0,0,0,1,1,1,0,0,0,0,1] + , [1,0,0,1,1,1,1,1,0,0,0,1] + , [0,0,1,1,1,0,1,1,1,0,0,0] + , [0,1,1,1,0,0,0,1,1,1,0,0] + , [1,1,1,0,0,1,0,0,1,1,1,0] -- center 1 + , [0,1,1,1,0,0,0,1,1,1,0,0] + , [0,0,1,1,1,0,1,1,1,0,0,0] + , [1,0,0,1,1,1,1,1,0,0,0,1] + , [0,0,0,0,1,1,1,0,0,0,0,1] + , [0,0,1,0,0,1,0,0,1,0,0,0] + , [0,1,1,1,0,0,0,1,1,1,0,0] + , [1,1,0,1,1,0,1,1,0,1,1,0] -- center 2 + , [0,1,1,1,0,0,0,1,1,1,0,0] + , [0,0,1,0,0,1,0,0,1,0,0,0] + , [0,0,0,0,1,1,1,0,0,0,0,1] + , [1,0,0,1,1,1,1,1,0,0,0,1] + , [0,0,1,1,1,1,1,1,1,0,0,0] + , [0,1,1,1,1,1,1,1,1,1,0,0] + , [1,1,1,1,1,1,1,1,1,1,1,0] + , [1,1,1,1,0,0,0,1,1,1,1,1] -- center 3 + , [0,1,1,1,1,1,0,0,1,1,1,1] + , [0,0,1,1,1,0,0,0,0,1,1,1] + , [1,0,0,1,0,0,0,0,1,1,1,1] + , [0,0,0,0,0,0,0,1,1,1,1,0] + , [1,0,0,0,0,0,1,1,1,1,0,0] + , [1,1,0,0,0,1,1,1,1,0,0,1] + , [1,1,1,0,1,1,1,1,0,0,0,0] + , [0,1,1,1,1,1,1,0,0,1,0,0] + , [0,0,1,1,1,1,0,0,0,1,1,0] + , [0,0,0,1,1,1,0,0,0,0,1,1] + , [0,0,0,0,1,1,0,1,0,0,0,1] + ] + w = 10 / 23 + h = 45 / 61 + ruchnik = + S.path + ! A.fill "none" + ! A.stroke "#CF101A" + ! (A.strokeWidth .: w) + ! A.d ruchnikDirs + ruchnikDirs = mkPath $ do + mapM_ + (\n -> drawLine (fromIntegral n) $ ruchnikMatrix !! n) + [0 .. 30] + mapM_ + (\n -> drawLine (fromIntegral n) $ ruchnikMatrix !! (60 - n)) + [31 .. 60] + drawLine n binL = do + mapM_ + (\k -> + if 0 == binL !! (fromEnum k) + then return () + else m ( 0 + (fromIntegral k)*w + w/2) (n*h) >> vr h + ) [0 .. 10] + if 0 == binL !! 11 + then return () + else m 5 (n*h) >> vr h + mapM_ + (\k -> + if 0 == binL !! k + then return () + else m (10 - (fromIntegral k)*w - w/2) (n*h) >> vr h + ) [0 .. 10] + + +-- flag of Switzerland +ch :: S.Svg +ch = + S.svg + ! A.viewbox "0 0 32 32" + ! A.width "200px" + ! A.height "200px" + $ do + background + cross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 32) + ! (A.height .: 32) + ! A.stroke "none" + ! A.fill "#FF0000" + cross = + S.path + ! A.fill "none" + ! A.stroke "#FFFFFF" + ! A.strokeWidth "6" + ! A.d crossDirs + crossDirs = mkPath $ do + m 16 6 + l 16 26 + m 6 16 + l 26 16 + + +-- flag of Cyprus +cyp :: S.Svg +cyp = + S.svg + ! A.viewbox "0 0 900 600" + ! A.width "300px" + ! A.height "200px" + $ do + background + cyCoA + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 900) + ! (A.height .: 600) + ! A.stroke "none" + ! A.fill "#FFFFFF" + + +-- flag of Czech Republic +cz :: S.Svg +cz = + S.svg + ! A.viewbox "0 0 6 4" + ! A.width "300px" + ! A.height "200px" + $ do + topStripe + leftTriangle + botStripe + where + topStripe = + S.path + ! A.strokeWidth "0" + ! A.fill "#FFFFFF" + ! A.d topDirs + topDirs = mkPath $ do + m 0 0 + l 6 0 + l 6 2 + l 3 2 + S.z + leftTriangle = + S.path + ! A.strokeWidth "0" + ! A.fill "#11457E" + ! A.d triangleDirs + triangleDirs = mkPath $ do + m 0 0 + l 3 2 + l 0 4 + S.z + botStripe = + S.path + ! A.strokeWidth "0" + ! A.fill "#D7141A" + ! A.d botDirs + botDirs = mkPath $ do + m 0 4 + l 6 4 + l 6 2 + l 3 2 + S.z + + +-- flag of Germany +de :: Svg +de = + flagH3Eq + (5,3) + "rgb(0,0,0)" + "rgb(255,0,0)" + "rgb(255,204,0)" + + +-- flag of Denmark +dk :: Svg +dk = + S.svg + ! A.viewbox "0 0 37 28" + ! A.width "370px" + ! A.height "280px" + $ do + background + cross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 37) + ! (A.height .: 28) + ! A.stroke "none" + ! A.fill "#C8102E" + cross = + S.path + ! A.fill "none" + ! A.stroke "#FFFFFF" + ! A.strokeWidth "4" + ! A.d crossDirs + crossDirs = mkPath $ do + m 14 0 + l 14 28 + m 0 14 + l 37 14 + + +-- flag of Estonia +ee :: Svg +ee = + flagH3Eq + (5.5, 3.5) + "#0072CE" + "#000000" + "#FFFFFF" + + +-- flag of Spain +es :: Svg +es = + S.svg + ! A.viewbox "0 0 3 2" + ! A.width "300px" + ! A.height "200px" + $ do + redBandTop + yellowBand + redBandBot + where + colRed = "rgb(198,11,30)" + colYellow = "rgb(255,196,0)" + redBandTop = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 3) + ! (A.height .: 0.5) + ! A.stroke "none" + ! A.fill colRed + yellowBand = + S.rect + ! (A.x .: 0) + ! (A.y .: 0.5) + ! (A.width .: 3) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill colYellow + redBandBot = + S.rect + ! (A.x .: 0) + ! (A.y .: 1.5) + ! (A.width .: 3) + ! (A.height .: 0.5) + ! A.stroke "none" + ! A.fill colRed + + +-- flag of the European Union +eu :: Svg +eu = + S.svg + ! A.viewbox "0 0 3 2" + ! A.width "300px" + ! A.height "200px" + $ do + background + mapM_ star [0..11] + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 3) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#003399" + starPos k = + ( 3/2 + (2/3) * cos (k*pi/6) + , 1 + (2/3) * sin (k*pi/6) + ) + star k = + starRegular 5 (1/9) (starPos k) + ! A.fill "#FFCC00" + ! A.id_ "HaskellSvgIcons-euFlagStar" + + +-- flag of Finland +fi :: S.Svg +fi = + S.svg + ! A.viewbox "0 0 36 22" + ! A.width "360px" + ! A.height "220px" + $ do + background + cross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 36) + ! (A.height .: 22) + ! A.stroke "none" + ! A.fill "#FFFFFF" + cross = + S.path + ! A.fill "none" + ! A.stroke "#002F6C" + ! A.strokeWidth "6" + ! A.d crossDirs + crossDirs = mkPath $ do + m 13 0 + l 13 26 + m 0 11 + l 36 11 + + +-- flag of France +fr :: S.Svg +fr = + flagV3Eq + (3,2) + "rgb(0,85,164)" + "rgb(255,255,255" + "rgb(239,65,53)" + + +-- flag of Greece +gr :: Svg +gr = + S.svg + ! A.viewbox "0 0 27 18" + ! A.width "300px" + ! A.height "200px" + $ do + blueLines + whiteLines + blueSquare + greekCross + where + blueLines = + S.path + ! A.fill "none" + ! A.stroke "#004C98" + ! A.strokeWidth "2" + ! A.d blueDirs + whiteLines = + S.path + ! A.fill "none" + ! A.stroke "#FFFFFF" + ! A.strokeWidth "2" + ! A.d whiteDirs + blueDirs = mkPath $ do + m 0 1 >> hr 27 + m 0 5 >> hr 27 + m 0 9 >> hr 27 + m 0 13 >> hr 27 + m 0 17 >> hr 27 + whiteDirs = mkPath $ do + m 0 3 >> hr 27 + m 0 7 >> hr 27 + m 0 11 >> hr 27 + m 0 15 >> hr 27 + blueSquare = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 10) + ! (A.height .: 10) + ! A.stroke "none" + ! A.fill "#004C98" + greekCross = + S.path + ! A.fill "none" + ! A.stroke "#FFFFFF" + ! A.strokeWidth "2" + ! A.d crossDirs + crossDirs = mkPath $ do + m 5 0 + l 5 10 + m 0 5 + l 10 5 + + +-- flag of Croatia +hrv :: Svg +hrv = + flagH3Eq + (4,2) + "#FF0000" + "#FFFFFF" + "#171796" + + +-- flag of Ireland +ie :: S.Svg +ie = + flagV3Eq + (3,1.5) + "rgb(22,155,98)" + "rgb(255,255,255)" + "rgb(255,136,62)" + + +-- flag of Iceland +is :: S.Svg +is = + S.svg + ! A.viewbox "0 0 25 18" + ! A.width "250px" + ! A.height "180px" + $ do + background + whiteCross + redCross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 25) + ! (A.height .: 18) + ! A.stroke "none" + ! A.fill "#02529C" + whiteCross = + S.path + ! A.fill "none" + ! A.strokeWidth "4" + ! A.stroke "#FFFFFF" + ! A.d crossDirs + redCross = + S.path + ! A.fill "none" + ! A.strokeWidth "2" + ! A.stroke "#DC1E35" + ! A.d crossDirs + crossDirs = mkPath $ do + m 0 9 + l 25 9 + m 9 0 + l 9 18 + + +-- flag of Italy +it :: Svg +it = + flagV3Eq + (3,2) + "rgb(0,140,69)" + "rgb(244,249,255" + "rgb(205,33,42)" + + +--flag of Liechtenstein +li :: Svg +li = + S.svg + ! A.viewbox "0 0 5 3" + ! A.width "500px" + ! A.height "300px" + $ do + topStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 5) + ! (A.height .: 1.5) + ! A.stroke "none" + ! A.fill "#002780" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 1.5) + ! (A.width .: 5) + ! (A.height .: 1.5) + ! A.stroke "none" + ! A.fill "#CF0921" + + +-- flag of Lithuania +lt :: Svg +lt = + flagH3Eq + (5,3) + "#FFB81C" + "#046A38" + "#BE3A34" + + +-- flag of Luxembourg +lu :: S.Svg +lu = + flagH3Eq + (3,2) + "#EA141D" + "#FFFFFF" + "#51ADDA" + + +-- flag of Latvia +lv :: S.Svg +lv = + S.svg + ! A.viewbox "0 0 20 10" + ! A.width "300px" + ! A.height "150px" + $ do + topStripe + midStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 20) + ! (A.height .: 4) + ! A.stroke "none" + ! A.fill "#A4343A" + midStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 4) + ! (A.width .: 20) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#FFFFFF" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 6) + ! (A.width .: 20) + ! (A.height .: 4) + ! A.stroke "none" + ! A.fill "#A4343A" + + +-- flag of Monaco +mc :: S.Svg +mc = + S.svg + ! A.viewbox "0 0 5 4" + ! A.width "500px" + ! A.height "400px" + $ do + topStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#CE1126" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 2) + ! (A.width .: 5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#FFFFFF" + + +-- flag of Moldova +md :: Svg +md = + flagV3Eq + (3,1.5) + "#003DA5" + "#FFD100" + "#C8102E" + + +-- flag of Montenegro +me :: Svg +me = + S.svg + ! A.viewbox (S.toValue $ "0 0 " ++ show w ++ " " ++ show h) + ! A.width "400px" + ! A.height "200px" + $ do + background + border + where + w = 400 + h = 200 + s = h / 40 + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 400) + ! (A.height .: 200) + ! A.stroke "none" + ! A.fill "#FF0000" + border = + S.path + ! A.fill "none" + ! A.stroke "#E6B319" + ! (A.strokeWidth .: 2*s) + ! A.d borderDirs + borderDirs = mkPath $ do + m (0 + s) (0 + s) + l (w - s) (0 + s) + l (w - s) (h - s) + l (0 + s) (h - s) + S.z + + +-- flag of North Macedonia +mk :: Svg +mk = + S.svg + ! A.viewbox "0 0 2 1" + ! A.width "400px" + ! A.height "200px" + $ do + background + rays + sun + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 2) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill "#CE2028" + d = 2/7 + sun = + S.circle + ! (A.cx .: 1) + ! (A.cy .: 0.5) + ! (A.r .: d/2) + ! A.fill "#F9D616" + ! A.stroke "#CE2028" + ! (A.strokeWidth .: d/8) + rays = + S.path + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.fill "#F9D616" + ! A.d raysDirs + x1 = 1 + (1/68) * sqrt (3825 / 98) -- 1.09187 etc. + x2 = 1 - (1/68) * sqrt (3825 / 98) + y1 = (3/5) * x1 - 1/10 + y2 = (3/5) * x2 - 1/10 + raysDirs = mkPath $ do + m (1 - 0.1) (0) + l (1 + 0.1) (0) + l (1 ) (0.5 - d/2 + d/8) + S.z + m (1 - 0.1) (1) + l (1 + 0.1) (1) + l (1 ) (0.5 + d/2 - d/8) + S.z + m (0 ) (0.5 - 0.1) + l (0 ) (0.5 + 0.1) + l (1 ) 0.5 + S.z + m (2 ) (0.5 - 0.1) + l (2 ) (0.5 + 0.1) + l (1 ) 0.5 + S.z + m (0 ) 0 + l (0 + 0.3) 0 + l x1 y1 + S.z + m (2 - 0.3) 0 + l (2 ) 0 + l x2 y1 + S.z + m (2 - 0.3) 1 + l (2 ) 1 + l x2 y2 + S.z + m (0 ) 1 + l (0 + 0.3) 1 + l x1 y2 + S.z + + +-- flag of Malta +mt :: Svg +mt = + S.svg + ! A.viewbox "0 0 3 2" + ! A.width "300px" + ! A.height "200px" + $ do + leftStripe + rightStripe + where + leftStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 1.5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#FFFFFF" + rightStripe = + S.rect + ! (A.x .: 1.5) + ! (A.y .: 0) + ! (A.width .: 1.5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "#C01B22" + + +-- flag of Netherlands +nl :: S.Svg +nl = + flagH3Eq + (3,2) + "#AE1C28" + "#FFFFFF" + "#21468B" + + +-- flag of Norway +no :: S.Svg +no = + S.svg + ! A.viewbox "0 0 22 16" + ! A.width "330px" + ! A.height "240px" + $ do + background + whiteCross + blueCross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 22) + ! (A.height .: 16) + ! A.stroke "none" + ! A.fill "#BA0C2F" + whiteCross = + S.path + ! A.fill "none" + ! A.stroke "#FFFFFF" + ! A.strokeWidth "4" + ! A.d crossDirs + blueCross = + S.path + ! A.fill "none" + ! A.stroke "#00205B" + ! A.strokeWidth "2" + ! A.d crossDirs + crossDirs = mkPath $ do + m 8 0 + l 8 16 + m 0 8 + l 22 8 + + +--flag of Poland +pl :: Svg +pl = + S.svg + ! A.viewbox "0 0 8 5" + ! A.width "400px" + ! A.height "250px" + $ do + topStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 8) + ! (A.height .: 2.5) + ! A.stroke "none" + ! A.fill "#FFFFFF" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 2.5) + ! (A.width .: 8) + ! (A.height .: 2.5) + ! A.stroke "none" + ! A.fill "#DC143C" + + +-- flag of Portugal +pt :: S.Svg +pt = + S.svg + ! A.viewbox "0 0 3 2" + ! A.width "300px" + ! A.height "200px" + $ do + greenBand + redBand + where + greenBand = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 6/5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "rgb(0,102,0)" + redBand = + S.rect + ! (A.x .: 6/5) + ! (A.y .: 0) + ! (A.width .: 9/5) + ! (A.height .: 2) + ! A.stroke "none" + ! A.fill "rgb(255,0,0)" + + +-- flag of Romania +ro :: Svg +ro = + flagV3Eq + (3,2) + "#002B7F" + "#FCD116" + "#CE1126" + + +-- flag of Serbia +rs :: Svg +rs = + flagH3Eq + (3,2) + "#C7363D" + "#0C4077" + "#FFFFFF" + + +-- flag of Russia +ru :: S.Svg +ru = + flagH3Eq + (3,2) + "#FFFFFF" + "#0039A6" + "#E4181C" + + +-- flag of Sweden +se :: S.Svg +se = + S.svg + ! A.viewbox "0 0 16 10" + ! A.width "320px" + ! A.height "200px" + $ do + background + cross + where + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 16) + ! (A.height .: 10) + ! A.stroke "none" + ! A.fill "#006AA7" + cross = + S.path + ! A.fill "none" + ! A.stroke "#FECC02" + ! A.strokeWidth "2" + ! A.d crossDirs + crossDirs = mkPath $ do + m 6 0 + l 6 10 + m 0 5 + l 16 5 + + +-- flag of Slovenia +si :: Svg +si = + flagH3Eq + (4,2) + "#FFFFFF" + "#0000FF" + "#FF0000" + + +-- flag of Slovakia +sk :: Svg +sk = + S.svg + ! A.viewbox "0 0 18 12" + ! A.width "360px" + ! A.height "240px" + $ do + topStripe + midStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 18) + ! (A.height .: 4) + ! A.stroke "none" + ! A.fill "#FFFFFF" + midStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 4) + ! (A.width .: 18) + ! (A.height .: 4) + ! A.stroke "none" + ! A.fill "#0B4EA2" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 8) + ! (A.width .: 18) + ! (A.height .: 4) + ! A.stroke "none" + ! A.fill "#EE1C25" + + +-- flag of San Marino +sm :: Svg +sm = + S.svg + ! A.viewbox "0 0 4 3" + ! A.width "400px" + ! A.height "300px" + $ do + topStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 4) + ! (A.height .: 1.5) + ! A.stroke "none" + ! A.fill "#FFFFFF" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 1.5) + ! (A.width .: 4) + ! (A.height .: 1.5) + ! A.stroke "none" + ! A.fill "#73E6F2" + + +-- flag of Ukraine +ua :: S.Svg +ua = + S.svg + ! A.viewbox "0 0 3 2" + ! A.width "300px" + ! A.height "200px" + $ do + topStripe + botStripe + where + topStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 3) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill "#0057B7" + botStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 1) + ! (A.width .: 3) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill "#FFDD00" + + +-- flag of Great Britain +uk :: S.Svg +uk = + S.svg + ! A.viewbox "0 0 50 30" + ! A.width "250px" + ! A.height "150px" + $ do + scotland + irelandBase + irelandBase ! A.transform (rotateAround 180 mx my) + englandRed + englandWhite + where + w = 50 + h = 30 + mx = w / 2 + my = h / 2 + -- x0 = 3 / sin (atan (3/5)) + x1 = 2 / sin (atan (3/5)) + -- y0 = 3 / sin (atan (5/3)) + y1 = 2 / sin (atan (5/3)) + colWhite = "white" + colBlue = "rgb(1,33,105)" + colRed = "rgb(200,16,46)" + scotland = do + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: w) + ! (A.height .: h) + ! A.stroke "none" + ! A.fill colBlue + S.path + ! (A.strokeWidth .: 6) + ! A.stroke colWhite + ! A.fill "none" + ! A.d scotlandDirs + scotlandDirs = mkPath $ do + m 0 0 + l w h + m 0 h + l w 0 + irelandBase = + S.path + ! A.stroke "none" + ! A.fill colRed + ! A.d irelandDirs + irelandDirs = mkPath $ do + m 0 0 + l 0 y1 + l (mx - x1) my + l mx my + S.z + m 0 h + l x1 h + l mx (my + y1) + l mx my + S.z + englandRed = + S.path + ! (A.strokeWidth .: 6) + ! A.stroke colRed + ! A.fill "none" + ! A.d englandDirsRed + englandWhite = + S.path + ! (A.strokeWidth .: 2) + ! A.stroke colWhite + ! A.fill "none" + ! A.d englandDirsWhite + englandDirsRed = mkPath $ do + m 0 my + l w my + m mx 0 + l mx h + englandDirsWhite = mkPath $ do + m 0 (my + 4) + l (mx - 4) (my + 4) + l (mx - 4) h + m (mx + 4) h + l (mx + 4) (my + 4) + l w (my + 4) + m w (my - 4) + l (mx + 4) (my - 4) + l (mx + 4) 0 + m (mx - 4) 0 + l (mx - 4) (my - 4) + l 0 (my - 4) + + +-- flag of the Holy See +va :: S.Svg +va = + S.svg + ! A.viewbox "0 0 1 1" + ! A.width "300px" + ! A.height "300px" + $ do + leftStripe + rightStripe + where + leftStripe = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 0.5) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill "#FFE000" + rightStripe = + S.rect + ! (A.x .: 0.5) + ! (A.y .: 0) + ! (A.width .: 0.5) + ! (A.height .: 1) + ! A.stroke "none" + ! A.fill "#FFFFFF" + + + +-- flag of Kosovo +xk :: Svg +xk = + S.svg + ! A.viewbox "0 0 840 600" + ! A.width "420px" + ! A.height "300px" + $ do + background + xkCoA + star (420 - d3, y3) + star (420 - d2, y2) + star (420 - d1, y1) + star (420 + d1, y1) + star (420 + d2, y2) + star (420 + d3, y3) + where + d1 = 42 + d2 = 124.3 + d3 = 203 + y1 = 121.7 + y2 = 136 + y3 = 164.8 + background = + S.rect + ! (A.x .: 0) + ! (A.y .: 0) + ! (A.width .: 840) + ! (A.height .: 600) + ! A.stroke "none" + ! A.fill "#244AA5" + star (c0,c1) = + starRegular 5 36 (c0,c1) + ! A.fill "#FFFFFF"
+ src/Images/FlagsCoA.hs view
@@ -0,0 +1,99 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Images.FlagsCoA where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Geometry +import Core.Utils + + +-------------------------------------------------------------------------------- + + +-- Flag of Albania "coat of arms" +-- Drawn for a viewbox 0 0 980 700 +alCoA :: Svg +alCoA = + S.path + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.fillRule "evenodd" + ! A.fill "#000000" + ! A.d (S.toValue dirs) + where + dirs :: String + dirs = "M516.51 528.944c-6.15-5.332-13.605-16.13-13.5-26.538.55-7.761 5.873-12.27 9.312-2.796 4.862 10.457 15.29 27.749 29.66 17.605 6.278-4.608 6.18-11.392-2.428-10.614-10.63-.728-17.16-6.577-21.917-21.636-.865-8.282 2.58-8.075 7.387-2.747 6.18 7.09 18.478 17.806 32.046 12.063 7.54-3.16 9.668-9.68-1.723-11.285-10.784.157-19.587-6.834-28.35-17.498-4.805-5.9 2.282-11.856 6.537-6.834 3.795 3.26 9.11 9.266 13.665 10.094 5.267 1.034 11.796.52 19.03-3.31 7.798-6.527 5.266-11.236-4.2-12.32-7.338.364-11.335 3.153-20.8-3.16-17.014-11.5-30.54-26.865-32.653-45.347-1.388-12.156 5.148-15.837 10.582-14.438 14.78 3.802 24.449 31.422 34.675 46.595 3.348 4.373 6.424 4.444 8.6 3.096 4.102-3.517 7.378-6.408 11.48-10.34 0 0 30.085 5.406 46.468 10.746l-18.242 6.483c-6.907-3.814-15.243.298-15.243 6.915-6.536 4.52-6.01 9.819-3.19 14.933.86-3.561 1.594-8.186 6.757-8.801 7.369 3.048 15.955-1.302 15.955-7.057l21.519-8.458 21.74 12.308c0 8.32 7.883 10.956 16.085 8.71 3.865 2.4 6.35 6.564 7.659 11.017 2.42-6.422 1.915-10.956-1.875-14.107 2.175-8.303-9.46-16.287-18.467-10.97l-15.64-8.98 26.77-.75c3.107 5.5 14.337 5.803 17.613 0 2.8-.767 5.166-1.255 10.625 2.803-1.72-6.566-5.068-9.373-10.09-9.373-3.816-6.761-17.626-6.73-19.62.882l-27.881.775 16.543-11.778c6.175 3.646 14.84-.407 16.575-7.03 2.462-2.927 5.498-4.302 11.474-2.316-3.08-5.455-7.42-7.083-15.258-3.38-7.15-5.418-16.574 1.153-15.144 6.608l-22.01 14.975c-15.976-4.767-44.91-12.19-44.91-12.19 3.445-3.624 6.94-6.991 10.379-10.665 1.242-2.152-.656-4.658-3.293-5.18-25.816-5.328-40.597-15.735-49.553-42.186-3.746-11.078 4.353-14.388 7.136-7.612 3.85 9.424 8.098 19.724 19.69 27.7 3.998 2.796 15.899.513 8.86-6.164-7.29-6.006-10.428-8.588-14.02-23.19 0-7.398 7.54-10.715 11.746-3.624 4.5 14.545 4.96 20.808 13.107 30.18 6.173 7.092 14.223 11.857 18.22 11.75 7.192-.1 14.432-7.87 4.813-13.511-14.125-5.642-19.287-13.353-21.366-20.708-2.274-12.833.21-19.046 7.952-12.733 10.98 12.476 31.94 35.717 42.92 46.538 12.305 9.424 26.423 9.73 37.66.157 6.432-7.404 4.15-15.372-5.921-13.667-22.726 1.918-39.935-9.367-58.817-39.862-3.697-6.884-4.71-16.771 3.445-9.416 9.41 12.733 23.13 23.554 35.89 28.212 12.806 4.602 23.38 2.06 27.481-1.968 4.943-4.942 3.643-17.392-4.91-14.39-7.038 2.484-16.957 3.104-27.28-.883-10.331-4.038-21.06-12.733-32.45-27.485-3.9-8.332-2.63-15.373 5.265-11.08 18.68 15.845 42.775 28.678 55.072 20.967 9.062-5.643 9.215-20.138-2.274-19.204-23.137 3.153-31.891-1.968-54.115-21.585-5.058-3.781-4.708-13.361 3.34-7.248 18.68 12.063 44.19 16.77 54.214 10.458 9.013-5.643 7.694-22.885-7.491-16.778-12.151 7.404-25.565 7.197-52.442-12.006-6.78-5.642-1.723-12.997 3.844-9.837 21.617 12.32 53.104 17.598 61.3-7.454 3.188-9.574-2.58-15.166-11.035-8.54-18.576 17.185-39.635 8.746-51.423.1-3.376-1.99-9.57-12.062 1.31-10.193 28.147 6.42 55.986.828 61.05-19.103 2.937-6.47-2.84-17.912-13.113-8.332-13.512 13.354-27.84 13.817-45.857 13.717-9.166-1.918-9.263-12.012-1.57-13.51 14.223.306 28.244-5.907 39.482-12.22 10.986-6.313 20.096-15.166 22.984-27.435 1.77-10.972-8.81-22.62-15.186-10.972-9.417 17.028-30.273 33.078-53.46 35.975-1.207-2.02-4.248-7.198-7.994-5.743-6.808 2.64-14.92 6.172-23.272 10.139-18.004 8.549-25.507 12.669-23.345 27.44 2.257 15.413-9.626 25.153-19.44 22.463-8.56-2.304-13.282-10.036-11.748-23.447 1.229-10.686 11.957-23.612 24.046-30.39 7.826-4.38 19.642-6.776 33.865-9.936 8.656-1.705 13.065-5.072 13.568-8.596 0 0-5.917 4.33-15.388 3.68-4.478-.32-7.478-2.29-8.608-4.3 3.293-.67 9.264.107 14.628.107 7.135-.057 23.702-1.655 28.097-11.7 1.367-6.626-2.987-7.817-7.038-3.573-4.353 4.587-6.146 8.71-14.88 10.25-5.314.935-10.63 2.02-17.466.365 3.85-4.573 9.968-9.252 15.186-8.39 1.716.286 3.997 1.87 5.824 4.716 1.116-7.248-.865-15.43-20.25-12.013.308-5.485-11.238-7.868-18.17-7.761-3.948.1-11.998 2.433-17.816 5.222-9.214 2.853-18.324 4.922-29.06 5.7 6.23 5.328 7.395 5.642 13.616 10.143-9.41 3.517-16.7 10.765-19.991 15.53 0 0 10.986-.307 13.77.934-11.496 3.36-16.659 5.379-22.733 11.592 2.127.364 5.314.984 6.682 1.505 1.423.514 1.053 1.448-.098 2.326-2.476 1.89-12.708 13.774-15.694 16.62-2.986-2.846-13.218-14.73-15.694-16.62-1.151-.878-1.521-1.812-.098-2.326 1.367-.52 4.555-1.141 6.682-1.505-6.075-6.213-11.237-8.232-22.733-11.592 2.784-1.241 13.77-.934 13.77-.934-3.293-4.765-10.582-12.013-19.992-15.53 6.222-4.501 7.387-4.815 13.616-10.144-10.735-.777-19.845-2.846-29.06-5.7-5.817-2.788-13.867-5.121-17.815-5.221-6.933-.107-18.478 2.276-18.17 7.76-19.385-3.416-21.366 4.766-20.25 12.014 1.827-2.846 4.108-4.43 5.824-4.715 5.218-.863 11.335 3.816 15.186 8.389-6.836 1.655-12.152.57-17.467-.364-8.733-1.54-10.526-5.664-14.88-10.25-4.051-4.245-8.404-3.054-7.037 3.573 4.395 10.044 20.96 11.642 28.097 11.699 5.364 0 11.335-.778 14.628-.107-1.13 2.012-4.13 3.98-8.608 4.3-9.472.65-15.388-3.68-15.388-3.68.503 3.524 4.91 6.89 13.568 8.596 14.223 3.16 26.039 5.557 33.865 9.937 12.089 6.777 22.817 19.703 24.045 30.389 1.534 13.41-3.188 21.143-11.747 23.447-9.814 2.69-21.697-7.05-19.44-22.463 2.162-14.771-5.341-18.891-23.345-27.44-8.352-3.967-16.464-7.5-23.272-10.14-3.746-1.454-6.787 3.725-7.994 5.744-23.187-2.897-44.043-18.947-53.46-35.975-6.376-11.648-16.957 0-15.186 10.972 2.888 12.27 11.998 21.122 22.984 27.435 11.238 6.313 25.259 12.526 39.482 12.22 7.693 1.498 7.596 11.592-1.57 13.51-18.018.1-32.345-.363-45.857-13.717-10.274-9.58-16.05 1.862-13.113 8.332 5.064 19.93 32.903 25.523 61.049 19.103 10.88-1.87 4.687 8.204 1.31 10.194-11.787 8.645-32.846 17.084-51.422-.1-8.454-6.627-14.224-1.035-11.035 8.539 8.196 25.052 39.683 19.774 61.3 7.454 5.567-3.16 10.624 4.195 3.844 9.837-26.877 19.203-40.29 19.41-52.442 12.006-15.185-6.107-16.504 11.135-7.491 16.778 10.023 6.313 35.533 1.605 54.213-10.458 8.05-6.113 8.398 3.467 3.34 7.248-22.223 19.617-30.977 24.738-54.114 21.585-11.49-.934-11.336 13.56-2.274 19.204 12.297 7.71 36.39-5.122 55.07-20.966 7.897-4.294 9.166 2.747 5.267 11.079-11.39 14.752-22.12 23.447-32.45 27.485-10.323 3.987-20.242 3.367-27.28.884-8.553-3.003-9.853 9.447-4.911 14.389 4.103 4.028 14.676 6.57 27.483 1.968 12.758-4.658 26.479-15.48 35.889-28.212 8.154-7.355 7.142 2.532 3.445 9.416-18.882 30.495-36.09 41.78-58.817 39.862-10.072-1.705-12.353 6.263-5.922 13.667 11.238 9.573 25.356 9.267 37.66-.157 10.98-10.821 31.94-34.062 42.92-46.538 7.743-6.313 10.227-.1 7.953 12.733-2.08 7.355-7.24 15.066-21.366 20.708-9.62 5.643-2.38 13.41 4.813 13.51 3.997.108 12.047-4.657 18.22-11.748 8.147-9.373 8.608-15.636 13.107-30.181 4.206-7.091 11.746-3.774 11.746 3.623-3.592 14.603-6.731 17.185-14.02 23.19-7.04 6.678 4.862 8.96 8.859 6.165 11.593-7.976 15.84-18.276 19.69-27.7 2.784-6.776 10.883-3.466 7.137 7.612-8.956 26.45-23.737 36.858-49.553 42.187-2.637.52-4.535 3.027-3.294 5.179 3.44 3.674 6.935 7.04 10.38 10.665 0 0-28.935 7.423-44.911 12.19l-22.01-14.975c1.43-5.455-7.993-12.026-15.144-6.61-7.839-3.701-12.178-2.073-15.258 3.382 5.976-1.986 9.012-.611 11.474 2.315 1.735 6.624 10.4 10.677 16.575 7.03l16.543 11.78-27.88-.776c-1.995-7.611-15.805-7.643-19.622-.882-5.02 0-8.37 2.807-10.09 9.373 5.46-4.058 7.827-3.57 10.626-2.803 3.276 5.803 14.506 5.5 17.612 0l26.771.75-15.64 8.98c-9.007-5.317-20.642 2.667-18.467 10.97-3.79 3.15-4.296 7.685-1.875 14.107 1.308-4.453 3.794-8.617 7.66-11.018 8.2 2.247 16.084-.388 16.084-8.71l21.74-12.307 21.52 8.458c0 5.755 8.585 10.105 15.954 7.057 5.163.615 5.897 5.24 6.757 8.8 2.82-5.113 3.346-10.412-3.19-14.932 0-6.617-8.336-10.73-15.243-6.915l-18.242-6.483c16.383-5.34 46.469-10.745 46.469-10.745 4.101 3.93 7.377 6.822 11.48 10.34 2.176 1.347 5.252 1.276 8.6-3.097 10.226-15.173 19.894-42.793 34.675-46.595 5.434-1.4 11.97 2.282 10.582 14.438-2.114 18.482-15.64 33.848-32.652 45.347-9.466 6.313-13.463 3.524-20.801 3.16-9.466 1.084-11.998 5.793-4.2 12.32 7.234 3.83 13.763 4.344 19.03 3.31 4.555-.828 9.87-6.834 13.665-10.094 4.255-5.022 11.342.934 6.536 6.834-8.762 10.664-17.565 17.655-28.35 17.498-11.39 1.605-9.262 8.125-1.722 11.285 13.568 5.743 25.865-4.972 32.046-12.063 4.806-5.328 8.252-5.535 7.387 2.747-4.758 15.059-11.287 20.908-21.917 21.636-8.608-.778-8.706 6.006-2.428 10.614 14.37 10.144 24.798-7.148 29.66-17.605 3.439-9.473 8.76-4.965 9.312 2.796.105 10.408-7.35 21.206-13.5 26.538C457.344 534.278 490 568.18 490 568.18s32.657-33.904 26.509-39.237zm43.763-383.94c-5.083 0-8.223 1.78-8.223 3.94 0 2.194 3.14 3.982 8.223 3.982 5.053 0 8.262-1.95 8.262-4.147 0-2.16-3.21-3.776-8.262-3.776zm-140.544 0c5.083 0 8.223 1.78 8.223 3.94 0 2.194-3.14 3.982-8.223 3.982-5.053 0-8.262-1.95-8.262-4.147 0-2.16 3.21-3.776 8.262-3.776z" + + +-- Flag of Cyprus "coat of arms" +-- Drawn for a viewbox 0 0 900 600 +cyCoA :: Svg +cyCoA = + do + defs $ + S.path + ! A.id_ "HaskellSvgIcons-cyFlagBranch" + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.fill "#4E5B31" + ! A.d (S.toValue branchDirs) + S.path + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.fill "#D57800" + ! A.d (S.toValue cyprusDirs) + S.use + ! A.xlinkHref "#HaskellSvgIcons-cyFlagBranch" + S.use + ! A.xlinkHref "#HaskellSvgIcons-cyFlagBranch" + ! A.transform (matrix (-1) 0 0 1 900 0) + where + cyprusDirs :: String + cyprusDirs = "M 727.13,103.96 l -2.35,0.93 l -0.92,0.36 L 721,105.11 l -2.67,1.28 l -4.74,3.23 l -0.20,0.15 l -1.76,0.46 l -1.64,-0.70 l -0.93,0.42 l -0.32,1.92 l -0.88,1.37 l -1.09,0.76 l -3.78,0.38 l -3.19,1.64 l -4.15,-1.11 l -1.92,0.75 l -4.1,3.69 l -2.09,0.99 l -0.73,-0.04 l -2.77,-0.14 l -1.17,0.38 l -1.75,1.69 l -3.31,0.25 l -1.03,0.71 l -1.61,3.26 l -1.75,1.80 l -1,0.21 l -1.08,-0.4 l -0.81,0.14 l -0.37,2.08 l -0.79,0.87 l -2.21,0.76 l -1.77,1.47 l -1.55,0.8 l -2.08,-0.05 h -0.47 l -2.07,1.14 l -3.9,0.34 l -1.62,1.54 l -0.35,0.33 l -0.75,0.45 l -1.24,0.74 l -0.3,0.18 l -1.5,-0.26 l -1.75,0.69 l -0.70,-1.08 l -1.21,0.72 l -1.6,0.06 l -2,-0.88 l -1.52,-0.67 l -1.11,0.16 l -0.38,1.94 l -0.03,0.20 l -1.17,1.55 l -2.18,1.32 l -0.3,0.38 l -2.48,3.20 l -4.72,4.96 l -3.99,2.02 l -4.13,1.25 l -2.9,2.38 l -7.6,3.76 L 597.58,166.7 l -2.45,0.78 l -3.52,0.56 l -6.27,2.31 l -5.53,1.67 l -0.30,0.09 l -1.1,0.33 l -7.81,2.36 l -3.63,-0.38 l -2.15,0.78 l -5.60,-0.62 l -3.9,0.07 l -2.46,0.51 l -4.63,2.22 l -7.82,3.76 l -2.58,2.36 l -4.02,2.1 l -4.71,1.49 l 0.01,-1.98 l -0.02,-0.08 l -1.63,0.51 l -1.18,0.37 l -3.82,0.59 h -2.12 l -1.32,-0.38 l -0.2,0.06 l -7.81,2.56 l -8.71,0.84 l -4.36,1.4 l -3.26,-0.05 l -2.03,0.60 l -4,0.48 l -1.42,-0.38 l -0.32,-0.08 l -11.75,0.51 l -5.37,-0.60 l -2.56,0.58 l -4.3,-1.44 l -6.26,-0.72 l -1.46,-0.43 l -3.3,-0.97 l -1.49,0.85 l -1.11,0.11 l -2.66,-0.96 l -0.96,-0.02 l -2.2,0.8 l -1.26,-0.32 l -1.17,-0.93 l -2.76,-0.41 l -1.68,-1.41 l -9.4,1.24 l -2.55,-0.75 l -8.55,-2.49 l -1.36,0.06 l -1.7,1.27 l -2.54,0.92 l -2.21,0.57 l -3.01,0.1 l -3.5,-0.91 l -3.60,-1.74 l -1.33,-0.31 l -2.97,0.3 l -0.91,0.08 l -5.46,-2.93 l -7.04,-4.4 l -4.77,-2.3 l -1.79,-0.29 l -0.24,0.85 l 0.89,2.8 l 0.3,2.77 l -0.09,2.56 l -0.04,1.58 l 0.44,1.42 l 1.72,1.91 l 0.71,1.92 l 0.52,5.28 l -0.00,5.36 l -0.83,8.55 l -0.28,1.3 l -1,4.43 l -0.91,4.06 l -3.54,10.83 l -0.97,1.34 l -2.39,1.63 l -5.41,3.68 l -3.99,2.3 l -1.26,0.52 l -3.23,0.24 l -2.01,-0.1 l -2.51,-1.36 l -2.46,-0.63 l -3.23,-2.32 l -3.6,-0.74 l -3.94,-2.27 l -1.02,-1.23 l -2.14,-0.2 l -2.97,-0.89 v -0.00 l -1.09,-0.32 l -0.75,-0.22 l 0,0 l -3.8,-0.1 l -3.54,-1.63 l -1.86,-0.45 l -2.54,-0.12 l -2.66,1.23 l 0,0 l -1.35,0.62 l -1.70,-0.67 l -1.23,0.07 l -1.4,2.11 L 308,231.1 l -0.96,0.51 l -1.2,-0.01 l -0.93,-0.02 l -1.01,0.44 l -1.36,0.59 l 0,0 l -1.20,0.52 l -0.59,0.25 l -0.01,-0.01 l -0.36,0.07 l -0.64,0.11 l -0.8,0.15 l -1.41,-0.82 l -0.75,-0.44 l -1.25,-0.25 l -0.67,0.48 l -0.13,2.3 l -0.61,1.37 l -1.96,1.73 l -1.99,1.75 l -1.38,2.04 l -3.67,8.39 l -2.3,3.38 l -0.71,0.78 l -2.41,2.66 l -2.13,1.65 l -4.92,3.81 l -4.65,1.74 l -4.01,0.82 l -1.95,0.00 l -3.7,-0.49 l -3.32,-1.02 l -3.65,-2.28 l -4,-3.21 l -5.79,-5.72 l -0.82,-0.49 l -0.17,-0.11 l -1.82,-1.16 l -1.35,0.03 l -0.53,0.87 l -0.29,1.26 l -0.24,1.12 l -0.66,6.36 l 0.04,0.36 l 0.34,2.62 l 4.4,6.15 l 1.35,3.26 l 0.22,0.37 l 0.90,1.52 l 0.69,1.16 l 0.06,0.11 l 1.5,4.48 l -1.05,2.53 l 0.53,1.7 l -1.33,1.03 l -0.24,1.46 l 3.95,4.95 l 0.86,2.18 l -0.96,3.02 l -1.53,1.67 l -0.42,0.45 l 0.21,1.28 l 1.81,1.63 l 3.08,2.75 l 1.64,4.08 l 1.25,1.1 l 1.45,-0.31 l 0.81,0.61 l 1.22,-0.02 l 1.20,1.20 l 0.78,0.37 l 1.23,0.61 l 0.97,1.27 l 0.21,3.91 l 1.82,4.86 l 0.02,2.63 l 0.01,0.37 l 1.13,1.94 l 0.35,1.53 l -0.6,4.06 l 1.44,1.30 l 1.56,-0.32 l 1.01,0.16 l 1.62,1.35 l 1.96,3 l 1.92,-0.28 l 1.22,0.58 l 5.9,5.33 l 1.33,0.67 l 0.07,0.04 l 0.96,0.48 l 1.2,1.20 l 1.85,-1.23 l 0.20,-0.02 l 2.01,-0.17 l 0.88,0.6 l 1.7,1.14 l 2.23,-0.02 l 4.84,1.48 l 2.11,0.54 l 4.26,2.64 l 1.81,1.12 l 1.07,0.87 l 1.42,1.16 l 2.84,1.22 l 2.44,0.58 l 1.32,0.31 l 1,0.38 l 0.02,-0.06 h 0.01 l -0.02,0.06 l 5.28,2.02 l 2.86,0.66 l 2.64,0.97 l 1.92,0.7 l 1.41,0.02 l 2,-1.68 l 1.93,-0.11 l 1.60,0.4 l 1.57,-0.26 l 2.48,-1.53 l 0.48,-0.71 l 1.76,-0.83 l 5.94,-0.73 l 1.73,0.56 l 4.46,-1.94 l 2.98,0.83 l 2.64,-0.93 l 5.77,1.28 l 1.53,1.08 l 1.71,1.96 l 0.21,0.00 l 1.91,0.03 l -0.8,1.33 l 2.52,2.64 l 2.27,3.44 l 0.15,0.45 l 1.65,4.86 l 1.23,1.72 l 0.86,2.40 l 0.04,1.56 l -1.34,1.02 l -0.22,0.58 l -0.07,0.21 l 0.27,0.65 l 0.50,-0.27 l 0.96,-0.53 L 380,379.26 l 2.06,0.22 l 1.36,0.14 l 2.15,-1.06 l 1.42,-0.71 l 2.29,0.98 l 2.52,-0.02 l 1.05,0.47 l 3,1.35 l 1.52,0.14 l 0.56,-0.37 l 0.36,-0.85 l -0.18,-1 L 397,377.23 l -2.53,-2.93 l -1.03,-1.51 l -0.78,-2.18 l -0.24,-2.79 l -0.17,-1.88 l 0.31,-2.47 l 0.68,-0.88 l 0.5,-1.96 h 0.00 l 0.12,-0.51 l 1.40,-1.86 l 3.72,-2.39 l 4,-3.58 l 3.16,-2.08 l 3.26,-1.41 l 0.08,-0.4 l 0.36,0.14 l 8.29,-2.81 l 0.13,-0.01 l 3.69,-0.64 l 24.92,1.75 l 0.92,-0.27 v -0.00 l 0.83,-2.33 l 0.44,-0.43 l 0.3,-0.28 l 2.74,-1.20 l 1.28,-0.18 l 3.55,0.87 l 1.45,0.35 l 2.33,-1.30 l 1.65,0.02 l 3.41,-1.86 l 2.11,0.05 l 0.8,-0.32 l 4.11,-2.95 l 3.96,-1.13 l 1.03,-0.54 l 0.36,-0.2 l 4.06,-2.14 l 2.57,-1.98 l 2.22,-1.18 l 2.43,-0.62 l 6.38,-0.44 l 1.28,-2.13 l 2.74,-0.36 l 1.65,-1.87 l 1.9,-0.77 l 1.35,-1.95 l 1.13,-1.64 l 1.59,-0.92 l 5.1,-0.32 l 6.04,0.74 l 0.8,-0.48 l 1.36,-4.87 l 1.43,-0.91 l 3.85,-5.61 l 0.01,-2.04 v -1.70 l 0.63,-2.43 l -0.43,-4.39 l 0.51,-4.44 l 2.39,-5.65 l 2.10,-2.27 l 3.4,-2.3 l 1.72,-0.75 l 2.44,-0.41 v 0.00 l 0.36,-0.06 l 0.62,-0.10 l 8.43,-0.11 c 0.11,-0.08 3.06,-0.04 3.06,-0.04 l 2.81,-0.03 L 561.38,282 l 0.50,0.08 l 2.4,0.77 l 2.77,2.15 L 570,287.89 l 0.55,0.53 l 1.9,0.8 l 0.57,0.25 l 1.57,-0.25 l 2.23,-1.16 l 1.68,-1.42 l 2.3,-1.25 l 0.05,-0.08 l 1.29,-1.94 l 0.03,-0.04 l 0.02,0.00 v -0.01 h -0.02 l 0.51,-0.77 l 4.44,-1.73 l 5.23,-0.3 l 0.58,-0.31 l 0.32,-0.17 l 1.38,-1.62 l 1.29,-0.01 l 3.13,1.13 l 2.2,-0.43 l 1.75,0.7 l 1.36,-0.16 l 2.56,-0.3 l 2.75,1.93 l 1.60,0.2 l 5.65,3.31 l 0.29,0.04 l 0.15,0.02 l 0.32,0.05 l 0.67,-0.2 l 1,-0.28 l 0.13,-0.03 l 0.12,0.17 l 0.64,0.90 l 0.88,0.12 l 1.04,-1.39 l -0.41,-0.63 l -0.15,-0.23 l -2.02,-0.41 l -1.81,-3.1 l 1.72,-1.86 l -2.71,-3.32 l -0.45,-0.55 l -0.15,-0.23 l -0.93,-1.42 l -4.74,-7.23 l -6.18,-4.93 l 0,0 l -2.16,-1.73 l -0.01,-0.01 l -0.75,-0.6 l -3.3,-3.35 l -2.35,-3.13 l -0.30,-0.67 l -0.48,-1.06 l -1.41,-3.07 l -2.46,-1.9 l -2.00,-2.19 l -0.1,-0.12 l -4.14,-5.62 l -0.68,-0.94 l -0.97,-0.56 l -2.06,-0.01 l -0.2,-0.2 l -0.11,-0.12 l 0.07,-0.07 l 0.99,-0.98 l 1.10,-0.27 l 0.47,-1.08 l -2.10,-6.1 l -0.01,-0.21 l -0.15,-1.95 l 1.71,-8.85 l 0.22,-1.07 l 2.92,-5.95 l 1.81,-1.48 l 1.98,-3.89 l 1.7,-2.48 l 1.62,-1.58 l 0.28,-0.16 l 2.93,-1.77 l 2.46,-0.34 l 2.34,-0.33 l 4.1,1.26 l 3.9,-0.07 l 0.76,-0.08 l 1.77,-0.2 l 2.91,-0.91 l 1.37,-0.84 l 0.71,-1.09 l 1.48,-4.98 l 0.47,-1.58 l 0.91,-1.72 l 5.30,-6.10 l 4.01,-3.71 l 9.01,-6.61 l 4.41,-2.63 l 2.25,-1.34 l 20.12,-8.94 l 5.23,-5.3 l 2.72,-2.75 l 4.82,-3.23 l 5.64,-2.31 l 4.85,-3.84 l 1.06,-1.33 l 1.33,-4.3 l 1.11,-0.26 l 1,-2.17 l 0.28,-0.61 l 3.96,-2.79 l 0.44,-0.22 l 15.38,-7.71 l 2.23,0.30 l 1.2,-1.79 l 4.47,-0.75 l 0.82,-0.14 l 1.1,-0.55 l 0.93,-1.6 v -0.31 l 0.12,-4.27 l 0.95,-1.15 l 0.52,-2.81 l 0.49,-0.65 l 0.51,-0.67 l 1.26,-0.89 l -0.22,-0.53 L 727.13,103.96 z" + branchDirs :: String + branchDirs = "M 463.1,506.74 c -0.13,-0.05 -0.25,-0.14 -0.34,-0.24 l -0.12,-0.11 c -0.55,-0.51 -1.08,-1.06 -1.58,-1.64 c -1.33,-1.51 -3.11,-3.72 -4.69,-5.68 c -3.11,-3.88 -5.68,-7.22 -6.17,-7.85 l -0.79,-1.03 l -7.76,-2.39 l -5.67,-2.64 l 3.03,-3.40 l 10.40,4.45 l 7.76,1.59 l 14.36,10.56 l -0.01,0.00 c -0.02,0.02 -2.08,1.73 -4.13,3.6 c -0.91,0.83 -2.06,1.9 -2.87,2.78 c -0.33,0.35 -0.64,0.74 -0.93,1.14 c -0.17,0.28 -0.32,0.57 -0.46,0.88 M 409.76,490.72 c -7.00,-0.06 -13.87,-1.98 -19.89,-5.56 h -0.00 v -0.00 c 0.73,-1.22 1.71,-2.27 2.87,-3.1 c 1.94,-1.42 5.44,-3.12 11.1,-3.15 h 0.11 c 6.7,0 14.9,2.27 24.37,6.77 C 422.71,489.00 416.29,490.75 409.76,490.72 l 0.01,0.01 L 409.76,490.72 z M 380.39,484.21 c -1.19,0.02 -2.34,-0.46 -3.17,-1.33 c -0.70,-0.82 -1.19,-1.81 -1.42,-2.87 c -0.32,-1.38 -0.43,-2.80 -0.35,-4.21 c 0.49,-0.21 1.02,-0.33 1.56,-0.35 h 0.11 c 2.51,0 4.49,2.17 5.33,4.33 c 0.46,0.95 0.56,2.04 0.27,3.06 c -0.42,0.89 -1.35,1.43 -2.34,1.37 L 380.39,484.21 z M 432.07,478.22 c -17.35,-2.47 -24.71,-8.75 -27.83,-13.58 c -1.97,-2.93 -2.90,-6.43 -2.63,-9.96 v -0.01 h 0.01 c 0.87,-0.2 1.76,-0.29 2.65,-0.29 c 4.61,0 16.43,2.32 27.8,23.84 l 0.00,0.01 l -0.02,-0.01 L 432.07,478.22 z M 396.49,474.78 c -7.41,0 -13.06,-1.28 -16.78,-3.8 c -1.58,-1.01 -2.85,-2.44 -3.68,-4.12 c -0.30,-0.63 -0.50,-1.32 -0.59,-2.02 c 2.47,-1.00 5.1,-1.56 7.76,-1.65 c 0.38,-0.01 0.76,-0.02 1.17,-0.03 c 5.73,0 14.44,1.87 23.64,10.78 l 0.00,0.00 h -0.01 c -3.82,0.52 -7.67,0.80 -11.53,0.84 L 396.49,474.78 z M 360.58,473.40 c -7.82,0 -18.56,-2.38 -25.26,-9.08 l -0.00,-0.00 h 0.02 c 5.09,-1.20 10.29,-1.89 15.52,-2.06 c 0.48,-0.01 0.98,-0.01 1.47,-0.01 c 7.33,0 12.94,1.42 16.68,4.22 c 1.04,0.62 1.82,1.61 2.17,2.78 c 0.08,0.85 -0.32,1.69 -1.05,2.15 c -1.68,1.27 -4.69,1.94 -8.94,2.01 l -0.6,0.02 L 360.58,473.40 z M 335.24,460.40 c -0.95,0.00 -1.86,-0.42 -2.47,-1.16 c -0.56,-0.74 -0.94,-1.60 -1.10,-2.52 c -0.25,-1.20 -0.35,-2.44 -0.29,-3.67 v -0.01 c 0.38,-0.17 0.79,-0.27 1.21,-0.27 l 0,0 c 0.98,0.03 1.90,0.45 2.58,1.15 c 0.75,0.74 1.33,1.64 1.68,2.64 c 0.35,0.83 0.41,1.76 0.18,2.63 c -0.29,0.73 -1.00,1.21 -1.8,1.21 L 335.24,460.40 z M 393.77,459.08 c -1.19,0.02 -2.34,-0.46 -3.17,-1.33 c -0.70,-0.82 -1.19,-1.81 -1.42,-2.87 c -0.32,-1.38 -0.43,-2.80 -0.35,-4.21 c 0.49,-0.21 1.02,-0.33 1.56,-0.35 h 0.11 c 2.51,0 4.49,2.17 5.33,4.33 c 0.46,0.95 0.56,2.04 0.27,3.06 c -0.42,0.89 -1.35,1.43 -2.34,1.37 L 393.77,459.08 z M 365.26,457.90 c -15.73,-0.55 -23.9,-5.02 -27.98,-8.68 c -1.74,-1.53 -3.18,-3.37 -4.24,-5.44 c -0.39,-0.77 -0.69,-1.59 -0.90,-2.43 l 0.02,-0.00 c 1.26,-0.38 2.56,-0.57 3.88,-0.57 h 0.36 c 5.30,0 16.11,2.22 28.85,17.15 v 0.01 L 365.26,457.90 z M 382.35,456.31 c -12.66,-1.92 -19.83,-7.36 -23.62,-11.58 c -2.33,-2.51 -4.11,-5.48 -5.21,-8.73 c 1.28,-0.29 2.58,-0.45 3.9,-0.46 c 0.16,0 0.34,-0.00 0.52,-0.00 s 0.36,0 0.55,0.00 c 6.36,0.13 17.93,3.02 23.85,20.78 h 0.01 L 382.35,456.31 z M 317.35,450.23 c -4.03,0.01 -8.04,-0.46 -11.96,-1.43 c -6.62,-1.65 -9.47,-4.18 -10.69,-6.02 c -0.52,-0.75 -0.87,-1.62 -1.03,-2.53 c -0.05,-0.35 -0.06,-0.71 -0.03,-1.07 l 0.03,-0.01 c 3.42,-0.84 6.93,-1.29 10.46,-1.32 c 0.23,0 0.48,-0.00 0.72,-0.00 c 2.87,-0.00 5.74,0.27 8.56,0.83 c 6.39,1.33 12.09,4.93 16.05,10.14 v 0.00 h -0.01 c -3.96,0.97 -8.03,1.44 -12.12,1.42 L 317.35,450.23 z M 346.74,439.55 c -1.19,0.03 -2.34,-0.44 -3.17,-1.3 c -0.71,-0.83 -1.2,-1.83 -1.42,-2.90 c -0.32,-1.37 -0.43,-2.78 -0.35,-4.18 c 0.49,-0.21 1.02,-0.33 1.56,-0.35 h 0.11 c 2.50,0 4.48,2.17 5.33,4.33 c 0.45,0.94 0.53,2.02 0.24,3.03 c -0.40,0.89 -1.32,1.44 -2.31,1.38 L 346.74,439.55 z M 324.64,436.52 c -4.20,-1.19 -8.23,-2.94 -11.96,-5.22 c -5.54,-3.41 -12.32,-9.45 -13.15,-18.83 l 0,0 h 0.01 c 0.42,-0.09 0.84,-0.14 1.27,-0.15 c 0.1,0 0.21,-0.00 0.33,-0.00 c 1.65,0 5.04,0.46 9.14,3.58 c 5.22,3.98 10.04,10.92 14.35,20.65 L 324.64,436.52 z M 339.07,435.99 c -3.43,-1.56 -6.62,-3.60 -9.46,-6.08 c -7.35,-6.33 -13.08,-14.33 -16.71,-23.33 c 0.90,-0.42 1.88,-0.66 2.88,-0.71 c 0.1,-0.00 0.2,-0.00 0.30,-0.00 c 0.15,0 0.30,0 0.46,0.00 c 2.41,0.06 6.08,1.07 10.15,5.46 c 4.67,5.04 8.85,13.34 12.4,24.65 l 0.01,0.03 l -0.03,-0.01 L 339.07,435.99 z M 301.68,434.90 c -4.82,0 -6.47,-2.61 -6.95,-3.74 c -0.48,-1.17 -0.67,-2.44 -0.55,-3.70 v -0.02 c 0.78,-0.19 1.59,-0.30 2.4,-0.31 h 0.16 c 3.15,-0.07 6.15,1.34 8.08,3.84 c 0.25,0.37 1.03,1.69 0.39,2.72 c -0.52,0.81 -1.7,1.22 -3.53,1.22 L 301.68,434.90 z M 291,421.43 c -3.73,0.00 -7.46,-0.31 -11.14,-0.95 c -4.29,-0.78 -6.72,-4.43 -8.01,-7.35 c -0.86,-1.99 -1.46,-4.10 -1.8,-6.25 h 0.01 c 13.28,0.39 19.55,4.27 22.47,7.45 c 1.81,1.88 2.94,4.32 3.20,6.92 h -0.00 c -0.02,0 -1.89,0.18 -4.74,0.18 L 291,421.43 z M 304.83,407.61 c -0.01,-0.02 -1.53,-1.9 -3.03,-4.22 c -1.57,-2.44 -3.02,-5 -3.02,-7.08 c 0,-2.01 -0.47,-6.26 -0.75,-8.61 c -0.35,-2.98 -0.72,-5.54 -0.75,-5.75 h 0.01 c 0.33,0.12 8.30,3.11 8.30,10.59 s -0.73,15.01 -0.74,15.08 v 0.01 H 304.82 L 304.83,407.61 z M 294.5,406.90 c -0.08,-0 -0.16,-0.00 -0.25,-0.02 c -2.35,-0.39 -6.5,-2.19 -11.07,-4.81 c -5.08,-2.91 -9.20,-6.03 -11.62,-8.79 c -2.2,-2.51 -3.5,-6.45 -3.88,-11.72 c -0.16,-2.38 -0.13,-4.78 0.08,-7.16 c 0.42,-0.13 0.86,-0.20 1.31,-0.2 c 1.76,0.02 3.64,0.82 6.18,2.57 c 2.31,1.64 4.48,3.49 6.49,5.51 c 2.54,2.52 4.94,5.18 7.2,7.97 l 0.03,0.04 c 0.26,0.47 2.53,4.57 4.30,8.55 c 0.88,1.83 1.56,3.76 2.02,5.74 c 0.17,0.58 0.17,1.2 0,1.78 c -0.07,0.18 -0.21,0.34 -0.38,0.44 c -0.13,0.06 -0.28,0.09 -0.44,0.09 L 294.5,406.90 z" + + + +-- Flag of Slovakia coat of arms +-- WORK IN PROGRESS +skCoA :: Svg +skCoA = + do + S.path + ! A.fill "#EE1C25" + ! A.stroke "#FFFFFF" + ! (A.strokeWidth .: 2*s) + ! A.d coatDirs + where + s = 0.09 + k1 = 3 + y1 = 6 + k2 = 2.5 + y2 = 8.3 + cm = 5.77 + cw = 2.77 + coatDirs = mkPath $ do + m (3 - s ) (3 - s) + c (cm - k1) y1 (cm - k2) y2 cm (9 + s) + c (cm + k2) y2 (cm + k1) y1 (cm + cw + s) (3 - s) + S.z + + +-- Flag of Kosovo "coat of arms" +-- Drawn for a viewbox 0 0 840 600 +xkCoA :: Svg +xkCoA = + S.path + ! A.stroke "none" + ! A.strokeWidth "0" + ! A.fill "#D0A650" + ! A.d (S.toValue dirs) + where + dirs :: String + dirs = "m 424.54,190.13 c 3.51,4.10 5.86,8.2 5.86,13.18 -2.95,1.45 -7.02,2.05 -9.38,4.69 14.65,-2.05 17.57,14.93 33.97,8.48 0.59,2.35 2.94,4.40 5.86,3.51 l 1.75,-4.67 c 6.43,-1.75 4.67,8.78 11.73,6.72 3.51,2.93 1.16,7.90 3.51,11.43 0,4.09 1.75,7.60 3.51,11.12 1.75,-2.03 2.91,-4.97 7.02,-4.09 2.91,3.21 5.27,6.14 5.86,9.66 -1.19,6.74 -2.94,12.59 4.08,16.11 v 2.05 c 4.70,2.05 15.24,-2.05 15.24,6.14 -0.59,2.93 2.91,0.29 4.10,2.05 2.91,-1.17 7.02,-0.57 10.54,-0.57 2.91,6.14 -3.51,10.54 -5.27,16.11 2.91,2.91 1.75,8.20 1.16,11.70 l -1.75,0.87 c 4.67,0.87 10.54,-0.56 14.65,2.07 l 7.62,2.91 c 3.51,-2.03 7.59,-2.35 12.29,-2.03 3.51,2.63 -1.19,7.02 1.75,9.06 4.11,0 7.62,0.59 8.18,4.11 l 0.59,1.16 c 2.91,-5.27 11.13,-1.75 14.65,-5.55 5.86,0 7.02,6.43 9.94,9.94 1.19,9.09 -9.94,13.20 -6.43,22.27 -2.35,4.39 -7.02,7.90 -10.54,12.01 1.16,0.59 0.56,2.03 0.56,2.91 -3.51,2.07 -0.56,8.22 -5.27,8.78 -0.56,3.82 -7.59,2.35 -5.27,6.46 4.70,6.14 -2.32,9.94 -2.32,15.53 -2.94,3.23 -8.81,-2.94 -8.81,3.23 -3.51,0.87 -7.02,-3.23 -9.34,0.28 -1.19,4.11 2.32,5.55 1.75,9.66 5.83,-0.59 7.59,5.27 9.94,8.78 l 5.86,5.86 c -5.86,4.67 -13.49,-0.59 -20.51,2.03 -1.75,-0.87 0,-3.2 -1.75,-4.07 -1.75,-2.07 -5.27,-2.07 -8.18,-2.63 0.56,2.63 -4.70,3.51 -2.35,6.71 0,0.87 1.16,3.51 -1.16,3.51 -4.70,1.47 -4.10,-4.07 -8.22,-2.03 -5.27,2.03 -1.16,9.94 -8.78,9.06 1.16,7.05 -11.70,11.73 -2.91,17.88 1.16,1.16 0.56,3.51 0.56,5.27 -5.27,4.70 -14.62,2.94 -20.48,1.19 -4.70,-1.19 -1.75,-7.05 -3.51,-10.25 -1.75,-2.94 -7.02,-4.98 -7.02,-9.09 -3.51,-1.44 -6.46,-2.35 -8.81,-5.27 -8.18,7.90 -18.16,15.53 -29.86,15.81 -5.27,2.63 -8.21,13.20 -16.40,8.81 -3.21,5.27 -12.89,0 -13.47,7.59 -3.81,1.47 -2.05,6.46 -4.39,8.78 -0.87,5.86 0,10.85 4.97,14.37 2.05,4.39 -4.39,4.39 -1.75,8.50 0.59,1.44 0,3.51 -0.87,4.10 -1.75,0.87 -2.33,1.75 -1.75,3.51 -1.45,0 -2.05,0.87 -3.21,2.03 -1.47,2.91 -6.14,4.39 -9.38,6.43 -3.21,0.87 -5.56,-1.44 -7.60,-3.51 -0.59,3.23 -3.23,4.98 -6.44,4.98 -4.69,0 -3.81,-4.11 -7.32,-5.86 1.45,-5.27 -3.23,-7.59 -1.75,-12.29 3.81,-2.91 10.24,-4.98 8.48,-11.13 -4.09,-4.95 -2.63,-12.29 -6.72,-18.16 -2.63,-2.32 -7.02,-5.83 -5.56,-11.42 3.81,-4.39 0,-9.66 -2.05,-14.33 -0.87,-3.82 -3.21,-7.34 -3.21,-11.73 -6.44,-3.79 -6.74,-13.77 -15.82,-14.65 -6.44,0 -7.60,-8.18 -14.05,-7.62 -0.59,-1.16 -2.05,-2.03 -3.23,-3.2 -4.67,3.2 -10.54,-0.87 -16.39,0.56 -3.81,-6.43 3.21,-15.21 -7.04,-19.04 v -4.07 c 1.17,0.56 1.75,-0.59 2.05,-1.19 0.58,-4.39 -7.32,-4.95 -4.09,-9.94 -1.75,-1.47 -3.81,-2.07 -2.63,-4.98 -4.40,-9.06 -17.58,-8.18 -20.51,-17.28 2.35,-2.03 2.35,-4.11 3.23,-5.86 -2.05,-3.51 -2.63,-7.31 -2.05,-11.10 2.05,-0.59 3.21,-3.23 4.39,-5.30 -2.63,-1.75 -5.85,-4.39 -8.78,-3.51 -5.27,-0.87 -9.08,-4.95 -13.77,-7.31 -1.17,-1.16 -0.57,-3.23 -0.57,-4.67 6.44,-2.07 -0.87,-11.15 7.02,-9.97 2.05,-2.63 6.44,-3.51 9.66,-5.56 3.23,-0.57 5.86,0.59 9.08,1.47 2.63,3.49 7.32,2.03 9.96,4.97 2.63,-0.59 5.86,-2.05 9.08,-0.59 0,-4.97 2.33,-7.90 5.86,-11.42 0.58,-2.03 3.79,-3.51 6.43,-4.67 4.98,1.16 10.84,1.16 14.37,-2.35 2.33,1.47 4.39,-1.45 7.02,-1.45 3.21,-0.59 5.85,0.28 8.20,1.75 0.28,-5.86 10.54,-0.87 12.59,-7.90 2.33,-4.69 -6.44,-6.44 -5.86,-10.55 -1.45,-4.69 2.05,-7.02 3.81,-10.24 2.05,-0.87 4.39,-2.05 7.02,-1.47 6.74,-2.33 1.47,-16.11 12.31,-11.12 0,1.45 -0.59,3.21 0.28,3.51 3.81,0 4.39,-4.39 7.04,-5.86 1.16,-4.09 -1.47,-9.08 2.03,-12.29 1.75,-0.29 3.23,-0.87 4.39,-2.35 0,-3.21 -1.75,-4.97 -4.39,-7.02 -0.87,1.46 -3.21,0.29 -4.68,0.87 0,-3.51 -2.04,-5.85 -2.63,-9.08 -1.75,-0.87 -2.63,-2.33 -2.03,-4.39 2.63,-2.63 0,-9.08 6.14,-7.62 2.33,-2.04 6.44,-0.58 8.78,-4.09 6.14,-3.51 14.35,-3.51 19.04,-9.96 2.05,0.29 4.39,-1.75 6.44,0 0.58,3.81 6.15,2.33 6.15,5"
+ src/Images/Mosaics.hs view
@@ -0,0 +1,939 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module Images.Mosaics where + +import Data.List (intersperse) +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import Core.Geometry +import Core.Utils + + + +mosaicSample :: [ (String , S.Svg) ] +mosaicSample = + [ (,) "nazariMosaic" (nazariMosaic "orange" "purple") + , (,) "triReligiousMosaic" (triReligiousMosaic "blue" "orange" "green") + , (,) "hexagonsMosaic" (hexagonsMosaic "navy" "none") + , (,) "beehiveMosaic" beehiveMosaic + , (,) "lemonsMosaic" (lemonsMosaic "gold") + , (,) "arabicMosaic" (arabicMosaic "blue" "brown") + , (,) "peopleMosaic" (peopleMosaic "silver" "white") + , (,) "hexMosaic" (hexMosaic "limegreen") + , (,) "arrowsMosaic" (arrowsMosaic "orange") + , (,) "wiresMosaic" (wiresMosaic "gray") + , (,) "curvesMosaic" curvesMosaic + , (,) "airplaneMosaic" (airplaneMosaic "deepskyblue") + ] + + + +-------------------------------------------------------------------------------- + + +nazariMosaic :: String -> String -> Svg +nazariMosaic colorUpper colorLower = + svg + ! A.viewbox (S.toValue vb) + ! A.width "300px" + ! A.height (S.toValue $ (show $ 300*h) ++ "px") + $ do + defs $ do + upperBirdie ! A.id_ "HaskellSvgIcons-upperBirdie" + lowerBirdie ! A.id_ "HaskellSvgIcons-lowerBirdie" + use ! xlinkHref id1 + use ! xlinkHref id1 ! A.transform (translate 2 0 ) + use ! xlinkHref id1 ! A.transform (translate (-1) h ) + use ! xlinkHref id1 ! A.transform (translate 1 h ) + use ! xlinkHref id1 ! A.transform (translate (-1) (-h)) + use ! xlinkHref id2 + use ! xlinkHref id2 ! A.transform (translate (-2) 0 ) + use ! xlinkHref id2 ! A.transform (translate (-1) (-h)) + use ! xlinkHref id2 ! A.transform (translate 1 (-h)) + use ! xlinkHref id2 ! A.transform (translate 1 h ) + where + vb = "-1 " ++ show (-h) ++ " 2 " ++ show (2*h) + id1 = "#HaskellSvgIcons-upperBirdie" + id2 = "#HaskellSvgIcons-lowerBirdie" + h = sqrt 3 + apt = h / 3 + ax = 0 + ay = -h + bx = 1 + by = 0 + cx = -1 + cy = 0 + dx = 0 + dy = h + mid x y = (x + y) / 2 + upperBirdie = + S.path + ! A.strokeWidth "0" + ! A.fill (S.toValue colorUpper) + ! A.d upperDirs + lowerBirdie = + S.path + ! A.strokeWidth "0" + ! A.fill (S.toValue colorLower) + ! A.d lowerDirs + upperDirs = + mkPath $ do + m ax ay + aa apt apt 0 False True (mid ax bx) (mid ay by) + aa apt apt 0 False False bx by + aa apt apt 0 False True (mid bx cx) (mid by cy) + aa apt apt 0 False False cx cy + aa apt apt 0 False True (mid ax cx) (mid ay cy) + aa apt apt 0 False False ax ay + S.z + lowerDirs = + mkPath $ do + m bx by + aa apt apt 0 False True (mid bx dx) (mid by dy) + aa apt apt 0 False False dx dy + aa apt apt 0 False True (mid cx dx) (mid cy dy) + aa apt apt 0 False False cx cy + aa apt apt 0 False True (mid bx cx) (mid by cy) + aa apt apt 0 False False bx by + S.z + + +-------------------------------------------------------------------------------- + + +triReligiousMosaic :: String -> String -> String -> Svg +triReligiousMosaic fill1 fill2 fill3 = + S.svg + ! A.viewbox (S.toValue $ "0 0 1 " ++ show (2*h)) + ! A.width "300px" + ! A.height (S.toValue $ (show $ 300 * sqrt 3) ++ "px") + $ do + defs $ do + S.path + ! A.strokeWidth "0" + ! A.fill "white" + ! A.d upperBird + ! A.id_ "HaskellSvgIcons-triReligiousUpperBird" + S.path + ! A.strokeWidth "0" + ! A.fill (S.toValue fill1) + ! A.d lowerBird + ! A.id_ "HaskellSvgIcons-triReligiousLowerBird" + starPolygonFirstSpecies 6 0.17 (0.5 , h - apt) + ! A.id_ "HaskellSvgIcons-triReligiousStar" + ! A.transform (rotateAround 30 0.5 (h - apt)) + S.path + ! A.strokeWidth "0" + ! A.d hexagonDirs + ! A.id_ "HaskellSvgIcons-triReligiousHexagon" + topBird + topBird ! A.transform (translate 1 0 ) + topBird ! A.transform (translate (-0.5) h ) + topBird ! A.transform (translate 0.5 h ) + topBird ! A.transform (translate (-0.5) (-h)) + botBird + botBird ! A.transform (translate (-1) 0 ) + botBird ! A.transform (translate (-0.5) (-h)) + botBird ! A.transform (translate 0.5 (-h)) + botBird ! A.transform (translate 0.5 h ) + hexagon ! A.fill "white" + hexagon ! A.fill "white" ! A.transform (translate (-0.5) (-h)) + hexagon ! A.fill "white" ! A.transform (translate 0.5 (-h)) + star ! A.fill (S.toValue fill2) + star ! A.fill (S.toValue fill3) ! A.transform (translate (-0.5) h ) + star ! A.fill (S.toValue fill3) ! A.transform (translate 0.5 h ) + where + topBird = + S.use ! A.xlinkHref "#HaskellSvgIcons-triReligiousUpperBird" + botBird = + S.use ! A.xlinkHref "#HaskellSvgIcons-triReligiousLowerBird" + hexagon = + S.use ! A.xlinkHref "#HaskellSvgIcons-triReligiousHexagon" + star = + S.use ! A.xlinkHref "#HaskellSvgIcons-triReligiousStar" + h = (sqrt 3) / 2 + apt = h / 3 + (ax,ay) = (0.5 , 0 ) + (bx,by) = (1 , h ) + (cx,cy) = (0 , h ) + (dx,dy) = (0.5 , 2*h) + mid x y = (x + y) / 2 + cos60 = 0.5 + sin60 = 0.5 * sqrt 3 + hexR = 0.24 + (h1x,h1y) = (0.5 + hexR , apt + h ) + (h2x,h2y) = (0.5 + hexR*cos60 , apt + h - hexR*sin60) + (h3x,h3y) = (0.5 - hexR*cos60 , apt + h - hexR*sin60) + (h4x,h4y) = (0.5 - hexR , apt + h ) + (h5x,h5y) = (0.5 - hexR*cos60 , apt + h + hexR*sin60) + (h6x,h6y) = (0.5 + hexR*cos60 , apt + h + hexR*sin60) + hexagonDirs = + mkPath $ do + m h1x h1y + l h2x h2y + l h3x h3y + l h4x h4y + l h5x h5y + l h6x h6y + S.z + upperBird = + mkPath $ do + m ax ay + aa apt apt 0 False True (mid ax bx) (mid ay by) + aa apt apt 0 False False bx by + aa apt apt 0 False True (mid bx cx) (mid by cy) + aa apt apt 0 False False cx cy + aa apt apt 0 False True (mid ax cx) (mid ay cy) + aa apt apt 0 False False ax ay + lowerBird = + mkPath $ do + m bx by + aa apt apt 0 False True (mid bx dx) (mid by dy) + aa apt apt 0 False False dx dy + aa apt apt 0 False True (mid cx dx) (mid cy dy) + aa apt apt 0 False False cx cy + aa apt apt 0 False True (mid bx cx) (mid by cy) + aa apt apt 0 False False bx by + S.z + + +------------------------------------------------------------------------------- + +hexagonsMosaic :: String -> String -> Svg +hexagonsMosaic strkColor fillColor = do + S.svg + ! A.viewbox (S.toValue $ "0 0 1 " ++ show (3*rad)) + ! A.width "300px" + ! A.height (S.toValue $ (show $ 300 * sqrt 3) ++ "px") + $ do + S.path + ! A.strokeLinecap "round" + ! A.strokeWidth "0.05" + ! A.stroke (S.toValue strkColor) + ! A.fill (S.toValue fillColor) + ! A.d hexagonDirs + where + apt = 0.5 -- apotema + rad = (2 / sqrt 3) * apt -- radio + aux = sqrt $ rad ^ 2 - apt ^ 2 -- proyeccion en el eje vertical + hexagonDirs = mkPath $ do + m 0.5 ( 3 * rad + 0.05) -- plus epsilon + l 0.5 (2.5 * rad) + m 0.5 0 + l 0.5 (0.5 * rad) + l 0 (0.5 * rad + aux) + l 0 (1.5 * rad + aux) + l 0.5 (2.5 * rad) + l 1 (1.5 * rad + aux) + l 1 (0.5 * rad + aux) + l 0.5 (0.5 * rad) + + +------------------------------------------------------------------------------- + + +beehiveMosaic :: Svg +beehiveMosaic = do + S.svg + ! A.viewbox (S.toValue $ "0 0 1 " ++ show (3*rad)) + ! A.width "300px" + ! A.height (S.toValue $ (show $ 300 * sqrt 3) ++ "px") + $ do + defs honeyGradient + hexagon + where + apt = 0.5 -- apotema + rad = (2 / sqrt 3) * apt -- radio + aux = sqrt $ rad ^ 2 - apt ^ 2 -- proyeccion en el eje vertical + hexagon = + S.path + ! A.strokeLinecap "round" + ! A.strokeWidth "0.05" + ! A.stroke "rgb(255,255,155)" + ! A.fill "url(#svg-honey-gradient)" + ! A.d hexagonDirs + hexagonDirs = + mkPath $ do + m 0.5 ( 3 * rad + 0.05) -- plus epsilon + l 0.5 (2.5 * rad) + m 0.5 0 + l 0.5 (0.5 * rad) + l 0 (0.5 * rad + aux) + l 0 (1.5 * rad + aux) + l 0.5 (2.5 * rad) + l 1 (1.5 * rad + aux) + l 1 (0.5 * rad + aux) + l 0.5 (0.5 * rad) + honeyGradient = + radialgradient + -- ! A.spreadmethod "reflect" + ! A.cx "30%" + ! A.cy "70%" + ! A.r "50%" + ! A.fx "50%" + ! A.fy "60%" + ! A.id_ "svg-honey-gradient" + $ do + stop + ! A.offset "0%" + ! A.style "stop-color: rgba(255,255,255,0.3)" + stop + ! A.offset "25%" + ! A.style "stop-color: rgba(255,255,0,0.4)" + stop + ! A.offset "50%" + ! A.style "stop-color: rgba(255,215,0,0.4)" + stop + ! A.offset "100%" + ! A.style "stop-color: rgba(255,140,0,0.4)" + + +------------------------------------------------------------------------------- + + +lemonsMosaic :: String -> Svg +lemonsMosaic fillColor = + svg + ! A.viewbox "0.15 0 0.85 1" + ! A.height "300px" + ! A.width (S.toValue $ show (0.85 * 300) ++ "px") + $ do + defs $ + lemon ! A.id_ "HaskellSvgIcons-lemonTile" + use ! xlinkHref iD ! A.transform ( rotateAround 29 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0 (-0.5) <> rotateAround 29 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0 0.5 <> rotateAround 29 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0.43 (-0.25) <> rotateAround (-29) 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0.43 0.25 <> rotateAround (-29) 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0.43 0.75 <> rotateAround (-29) 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate (-0.43) (-0.75) <> rotateAround (-29) 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate (-0.43) (-0.25) <> rotateAround (-29) 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate (-0.43) 0.25 <> rotateAround (-29) 0.5 0.5) + where + iD = "#HaskellSvgIcons-lemonTile" + r1 = 0.24 + r2 = r1 + k = 0.2 -- k must be lower than r1 + x0 = 0.5 + y0 = 0.5 + y1 = y0 - k + y2 = y0 + k + f1 y = x0 - sqrt(r1^2 - (y - y0)^2) + f2 y = x0 + sqrt(r1^2 - (y - y0)^2) + lemon = + S.path + ! (A.strokeWidth .: 0) + ! A.fill (S.toValue fillColor) + ! A.d lemonDirs + lemonDirs = mkPath $ do + m 0.5 0.15 + aa r2 r2 0 False True (f1 y1) y1 + aa r1 r1 0 False False (f1 y2) y2 + aa r2 r2 0 False True 0.5 0.85 + aa r2 r2 0 False True (f2 y2) y2 + aa r1 r1 0 False False (f2 y1) y1 + aa r2 r2 0 False True 0.5 0.15 + S.z + + +-------------------------------------------------------------------------------- + + +arabicMosaic :: String -> String -> Svg +arabicMosaic c1 c2 = + svg + ! A.viewbox "-1 -1 2 2" + ! A.width "300px" + ! A.height "300px" + $ do + defs $ + corner ! A.id_ "HaskellSvgIcons-arabicTile" + S.g $ do + use ! xlinkHref iD + use ! xlinkHref iD ! A.transform (rotateAround 180 0 0 ) + use ! xlinkHref iD ! A.transform (translate (-1) 0 <> rotateAround 270 0.5 0.5) + use ! xlinkHref iD ! A.transform (translate 0 (-1) <> rotateAround 90 0.5 0.5) + where + color1 = S.toValue c1 + color2 = S.toValue c2 + iD = "#HaskellSvgIcons-arabicTile" + s = 0.05 + k1 = 0.16 + k2 = (1/3) * (0.5 - k1 + s) + (ax, ay) = (0.5 + k1, 0.5 - k1) + (bx, by) = (0.5 - k1, 0.5 + k1) + corner = + S.g + ! A.fill "none" + ! (A.strokeWidth .: 2*s) + ! A.strokeLinecap "round" + $ do + S.path ! A.stroke color1 ! A.d dirs1 + S.path ! A.stroke color2 ! A.d dirs2 + S.path ! A.stroke color1 ! A.d dirs3 + S.rect + ! (A.x .: ax - s) + ! (A.y .: ay - s) + ! (A.width .: 2*s) + ! (A.height .: 2*s) + ! A.fill color1 + dirs1 = mkPath $ do + m 0.5 1 + l ax (1-k2) + l ax ay + dirs2 = mkPath $ do + m 1 0.5 + l (1-k2) by + l bx by + l bx k2 + l 0.5 0 + dirs3 = mkPath $ do + m ax ay + l k2 ay + l 0 0.5 + + +-------------------------------------------------------------------------------- + + +peopleMosaic :: String -> String -> Svg +peopleMosaic strkColor fillColor = + S.svg + ! A.viewbox "-1 -1 2 2" + ! A.height "300" + ! A.width "300" + $ S.g $ do + part1 + part1 ! A.transform horizontalMirrorMatrix + where + part1 = S.g $ do + mainLine + mainLine ! A.transform (translate 1 1) + mainLine = + S.path + ! A.fill (S.toValue fillColor) + ! A.stroke (S.toValue strkColor) + ! (A.strokeWidth .: 0.05) + ! A.d mainPath + mainPath = mkPath $ do + m 0 (-1) + q (-0.6) (-0.8) (-0.4) (-0.5) + q (-1) (-0.6) (-1) 0 + + +-------------------------------------------------------------------------------- + + +hexMosaic :: String -> Svg +hexMosaic strkColor = + S.svg + ! A.viewbox (S.toValue $ concat $ intersperse " " $ map show [vbX, vbY, vbW, vbH]) + ! A.height "300px" + ! A.width (S.toValue $ show (300 * sqrt 3) ++ "px") + $ do + S.defs $ + baseHexDef + S.g $ do + baseHex ! A.transform (translate 0 ((-3) * k)) + baseTile + baseTile ! A.transform (translate ((-3) * k * cos30) ((-3) * k * sin30)) + baseTile ! A.transform (translate ( 3 * k * cos30) ((-3) * k * sin30)) + baseTile ! A.transform (translate ((-3) * k * cos30) ( 3 * k * sin30)) + baseTile ! A.transform (translate ( 3 * k * cos30) ( 3 * k * sin30)) + where + vbX = (-1) * 0.5 * vbW + vbY = (-1) * 0.5 * vbH + vbW = 6 * k * cos30 + vbH = 3 * k + k = 1 -- side of base hex + cos30 = 0.5 * sqrt 3 + sin30 = 0.5 + baseHex = S.use ! A.xlinkHref "#HaskellSvgIcons-hexTile" + baseTile = + S.g $ do + baseHex + baseHex ! A.transform (rotateAround 120 0 0) + baseHex ! A.transform (rotateAround 240 0 0) + baseHexDef = + S.path + ! A.id_ "HaskellSvgIcons-hexTile" + ! A.fill "none" + ! A.stroke (S.toValue strkColor) + ! A.strokeWidth "0.05" + ! A.strokeLinecap "round" + ! A.strokeLinejoin "round" + ! A.d baseHexDirs + baseHexDirs = S.mkPath $ do + m ( k * cos30) (k * sin30) + l 0 0 + l 0 k + lr ( k * cos30) (k * sin30) + m 0 0 + l (-k * cos30) (k * sin30) + lr 0 k + lr ( k * cos30) (k * sin30) + --- + m ( k * cos30) ( k * sin30 + 1/3 * k) + l (1/3 * k * cos30) (1/3 * k * sin30 + 1/3 * k) + l (1/3 * k * cos30) (1/3 * k * sin30 + 2/3 * k) + l ( k * cos30) ( k * sin30 + 2/3 * k) + --- + m (2/3 * k * cos30) (2/3 * k * sin30 + 4/3 * k) + lr ( -1 * k * cos30) ( -1 * k * sin30 ) + lr 0 (2/3 * k * (-1) ) + lr (1/3 * k * cos30 * (-1)) (1/3 * k * sin30 ) + lr 0 (2/3 * k ) + lr ( k * cos30) ( k * sin30) + + +-------------------------------------------------------------------------------- + + +arrowsMosaic :: String -> Svg +arrowsMosaic strkColor = + S.svg + ! A.viewbox (S.toValue $ "0 0 1 " ++ show (2*h)) + ! A.width "300px" + ! A.height (S.toValue $ show (300 * sqrt 3) ++ "px") + $ do + defs $ + basePath ! A.id_ "HaskellSvgIcons-arrowTile" + arrowTile + arrowTile ! A.transform (translate 1 0 ) + arrowTile ! A.transform (translate (-0.5) h ) + arrowTile ! A.transform (translate 0.5 h ) + arrowTile ! A.transform (translate (-0.5) (-h)) + arrowTile ! A.transform ( mirror) + arrowTile ! A.transform (translate (-1) 0 <> mirror) + arrowTile ! A.transform (translate (-0.5) (-h) <> mirror) + arrowTile ! A.transform (translate 0.5 (-h) <> mirror) + arrowTile ! A.transform (translate 0.5 h <> mirror) + where + h = sin60 + sin60 = 0.5 * sqrt 3 + cos60 = 0.5 + tan60 = sin60 / cos60 + tan60' = cos60 / sin60 + k = (1/6) * (cos60 / sin60) + (ax,ay) = (tan60' * k , h - k ) + (bx,by) = (0.5 + 2*k*tan60' , h - k ) + (cx,cy) = (0.5 , h - 3*k ) + (dx,dy) = (0.5 - 2*k/sin60 , h - 3*k ) + (ex,ey) = (0.5 + k*tan60' , k ) + (fx,fy) = (0.5 + 2*k*tan60' , h - 5*k ) + (gx,gy) = (1 - 2*k*tan60' , h ) + arrowTile = + S.use ! A.xlinkHref "#HaskellSvgIcons-arrowTile" + mirror = S.matrix 1 0 0 (-1) 0 (2*h) + basePath = + S.path + ! d baseDirections + ! fill "none" + ! strokeWidth "0.03" + ! stroke (S.toValue strkColor) + ! strokeLinecap "round" + ! strokeLinejoin "round" + baseDirections = mkPath $ do + m cx cy + l bx by + l ax ay + m cx cy + l dx dy + l ex ey + m cx cy + l fx fy + l gx gy + + +-------------------------------------------------------------------------------- + + +wiresMosaic :: String -> Svg +wiresMosaic strkColor = + S.svg + ! A.viewbox "0 0 1 1" + ! A.height "300px" + ! A.width "300px" + $ do + defs $ + topLeftCorner ! A.id_ "HaskellSvgIcons-wireTile" + corner + corner ! A.transform (matrix 1 0 0 (-1) 0 1) + corner ! A.transform (matrix (-1) 0 0 1 1 0) + corner ! A.transform (rotateAround 180 0.5 0.5) + where + oct k = (k * sqrt 2) / (2 + sqrt 2) + corner = + S.use ! A.xlinkHref "#HaskellSvgIcons-wireTile" + topLeftCorner = + S.path + ! A.fill "none" + ! A.strokeWidth "0.002" + ! A.stroke (S.toValue strkColor) + ! A.d topLeftDirections + topLeftDirections = mkPath $ do + m 0.49 0 + l 0.49 0.5 + m 0.48 0 + l 0.48 0.5 + m 0.47 0 + l 0.47 0.5 + ----------------------- + m 0.435 0 + l 0.435 0.07 + l 0.42 0.12 + l 0.42 0.15 + m 0.42 0.12 + l 0.428 0.13 + l 0.428 0.15 + m 0.435 0.07 + l 0.45 0.12 + l 0.45 0.22 + m 0.45 0.12 + l 0.44 0.15 + l 0.44 0.18 + ----------------------- + m 0.4 0 + l 0.4 0.15 + l 0.45 0.3 + l 0.45 0.5 + m 0.39 0 + l 0.39 0.15 + l 0.44 0.3 + l 0.44 0.5 + m 0.38 0 + l 0.38 0.15 + l 0.43 0.3 + l 0.43 0.5 + ----------------------- + m 0 0.025 + l 0.14 0.025 + l 0.18 0.045 + m 0 0.035 + l 0.14 0.035 + l 0.18 0.045 + m 0 0.045 + l 0.18 0.045 + m 0 0.055 + l 0.14 0.055 + l 0.18 0.045 + m 0 0.065 + l 0.14 0.065 + l 0.18 0.045 + ----------------------- + m 0 0.125 + l 0.14 0.125 + l 0.18 0.145 + m 0 0.135 + l 0.14 0.135 + l 0.18 0.145 + m 0 0.145 + l 0.18 0.145 + m 0 0.155 + l 0.14 0.155 + l 0.18 0.145 + m 0 0.165 + l 0.14 0.165 + l 0.18 0.145 + ----------------------- + m 0 0.225 + l 0.14 0.225 + l 0.18 0.245 + m 0 0.235 + l 0.14 0.235 + l 0.18 0.245 + m 0 0.245 + l 0.18 0.245 + m 0 0.255 + l 0.14 0.255 + l 0.18 0.245 + m 0 0.265 + l 0.14 0.265 + l 0.18 0.245 + ----------------------- + m 0.18 0.045 + l 0.22 0.045 + l 0.27 0.095 + l 0.3 0.095 + l 0.3 0.3 + l 0.4 0.35 + l 0.4 0.5 + m 0.18 0.145 + l 0.22 0.145 + l 0.25 0.175 + l 0.28 0.175 + l 0.28 0.3 + l 0.38 0.35 + l 0.38 0.5 + m 0.18 0.245 + l 0.22 0.245 + l 0.23 0.255 + l 0.26 0.255 + l 0.26 0.3 + l 0.36 0.35 + l 0.36 0.5 + ----------------------- + m 0.5 0 + l 0.35 0 + m 0.25 0 + l 0.25 0.05 + l 0.3 0.05 + m 0.35 0 + l 0.35 0.05 + l 0.3 0.05 + l 0.3 0.07 + l 0.35 0.07 + l 0.35 0.25 -- CENTER OF THE FLOWER + l 0.33 0.23 + l 0.33 0.21 + m 0.33 0.23 + l 0.31 0.23 + m 0.35 0.25 + l 0.38 0.25 + m 0.35 0.25 + l 0.32 0.27 + l 0.32 0.29 + l 0.34 0.30 + m 0.35 0.25 + l 0.35 0.27 + l 0.34 0.28 + m 0.35 0.27 + l 0.36 0.28 + l 0.36 0.3 + m 0.35 0.25 + l 0.38 0.27 + l 0.38 0.29 + -- l 0.39 0.30 + -- l 0.37 0.30 + -- l 0.38 0.31 + l 0.415 0.31 + l 0.415 0.5 + m 0.35 0.25 + l 0.37 0.23 + l 0.37 0.21 + m 0.37 0.23 + l 0.39 0.23 + ----------------------- + m 0 0.49 + l 0.01 0.5 + m 0 0.47 + l 0.03 0.5 + m 0 0.45 + l 0.05 0.5 + m 0 0.43 + l 0.07 0.5 + ----------------------- + m 0 0.4 + l (oct 0.1) 0.4 + l 0.1 (0.5 - oct 0.1) + l 0.1 0.5 + m 0 0.38 + l (oct 0.12) 0.38 + l 0.12 (0.5 - oct 0.12) + l 0.12 0.5 + m 0 0.36 + l (oct 0.14) 0.36 + l 0.14 (0.5 - oct 0.14) + l 0.14 0.5 + m 0 0.34 + l (oct 0.16) 0.34 + l 0.16 (0.5 - oct 0.16) + l 0.16 0.5 + ----------------------- + m 0 0.3 + l 0.2 0.3 + l 0 0.5 + m 0.2 0.3 + l 0.2 0.5 + m 0.2 0.5 + l 0.415 0.5 + m 0.2 0.475 + l 0.36 0.475 + m 0.2 0.45 + l 0.36 0.45 + ----------------------- + m 0.28 0.45 + l 0.28 0.39 + l 0.25 0.39 + m 0.28 0.39 + l 0.31 0.39 + m 0.28 0.39 + l 0.28 0.36 + + +-------------------------------------------------------------------------------- + + +curvesMosaic :: Svg +curvesMosaic = + S.svg + ! A.viewbox "0 0 1 1" + ! A.height "300px" + ! A.width "300px" + $ do + curve1 + curve2 + curve3 + curve4 + curve5 + curve6 + curve7 + littleCircle + where + littleCircle = do + S.circle ! A.fill "purple" ! A.r "0.03" ! A.cx "0" ! A.cy "0" + S.circle ! A.fill "purple" ! A.r "0.03" ! A.cx "1" ! A.cy "0" + S.circle ! A.fill "purple" ! A.r "0.03" ! A.cx "0" ! A.cy "1" + S.circle ! A.fill "purple" ! A.r "0.03" ! A.cx "1" ! A.cy "1" + curve1 = + S.path + ! A.fill "none" + ! A.stroke "orchid" + ! A.strokeWidth "0.03" + ! A.strokeLinecap "round" + ! A.d curve1Dirs + curve1Dirs = mkPath $ do + m 0 0.25 + aa 0.2 0.2 0 True True 0.3 0.7 + aa 0.2 0.2 0 True True 0.7 0.7 + aa 0.2 0.2 0 True True 1 0.25 + curve2 = + S.path + ! A.fill "none" + ! A.stroke "crimson" + ! A.strokeWidth "0.015" + ! A.d curve2Dirs + curve2Dirs = mkPath $ do + m 0 0.25 + aa 0.125 0.125 0 True True 1 0.5 + aa 0.125 0.125 0 True True 0 0.75 + aa 0.125 0.125 0 True True 1 1 + curve3 = + S.path + ! A.fill "none" + ! A.stroke "green" + ! A.strokeWidth "0.015" + ! A.strokeLinecap "round" + ! A.d curve3Dirs + curve3Dirs = mkPath $ do + m 0 0 + aa 0.1 0.1 0 True True 0 0.125 + m 1 0.125 + aa 0.1 0.1 0 True False 1 0.25 + m 0 0.25 + aa 0.1 0.1 0 True True 0 0.375 + m 1 0.375 + aa 0.1 0.1 0 True False 1 0.5 + m 0 0.5 + aa 0.1 0.1 0 True True 0 0.625 + m 1 0.625 + aa 0.1 0.1 0 True False 1 0.75 + m 0 0.75 + aa 0.1 0.1 0 True True 0 0.875 + m 1 0.875 + aa 0.1 0.1 0 True False 1 1 + -- m 0 0 + -- l 0.16 0 + -- m 0.84 0 + -- l 1 0 + curve4 = + S.path + ! A.fill "none" + ! A.stroke "gold" + ! A.strokeWidth "0.02" + ! A.strokeLinecap "round" + ! A.d curve4Dirs + curve4Dirs = mkPath $ do + m 0.5 0 + c 0.1 0.1 0.8 0.1 0.5 0.25 + l 0.5 0.7 + c 0.9 0.8 0.1 0.9 0.5 0.9 + q 0.7 0.9 0.5 0.98 + l 0.5 1 + curve5 = + S.path + ! A.fill "none" + ! A.stroke "teal" + ! A.strokeWidth "0.025" + ! A.strokeLinecap "round" + ! A.d curve5Dirs + curve5Dirs = mkPath $ do + m 0.3 0 + aa 0.2 0.2 0 True False 0.7 0 + m 0.3 1 + aa 0.2 0.2 0 True True 0.7 1 + curve6 = + S.path + ! A.fill "deepskyblue" + ! A.stroke "skyblue" + ! A.strokeWidth "0.01" + ! A.strokeLinecap "round" + ! A.d curve6Dirs + curve6Dirs = mkPath $ do + m 0.47 0 + aa 0.03 0.03 0 True False 0.53 0 + m 0.47 1 + aa 0.03 0.03 0 True True 0.53 1 + curve7 = + S.path + ! A.fill "none" + ! A.stroke "deeppink" + ! A.strokeWidth "0.03" + ! A.strokeLinecap "round" + ! A.d curve7Dirs + curve7Dirs = mkPath $ do + m 0.25 0.8 + l 0.25 0.85 + m 0.75 0.8 + l 0.75 0.85 + m 0.25 0.1 + l 0.25 0.15 + m 0.75 0.1 + l 0.75 0.15 + + +-------------------------------------------------------------------------------- + + +airplaneMosaic :: String -> Svg +airplaneMosaic fillColor = + S.svg + ! A.viewbox "0 0 2 2" + ! A.height "300px" + ! A.width "300px" + $ do + defs $ + basicPlane ! A.id_ "HaskellSvgIcons-planeTile" + plane ! A.transform (translate 1 (-0.5)) + plane ! A.transform (translate 0 0.5 ) + plane ! A.transform (translate 1 1.5 ) + plane ! A.transform (translate 0 (-0.5) <> S.matrix 1 0 0 (-1) 0 1) + plane ! A.transform (translate 1 0.5 <> S.matrix 1 0 0 (-1) 0 1) + plane ! A.transform (translate 0 1.5 <> S.matrix 1 0 0 (-1) 0 1) + where + r1 = 0.5 * sqrt 2 + y1 = 1.5 - 0.5 * sqrt 2 + plane = + S.use ! A.xlinkHref "#HaskellSvgIcons-planeTile" + basicPlane = + S.path + ! A.stroke "none" + ! A.fill (S.toValue fillColor) + ! A.d basicPlaneDirs + basicPlaneDirs = mkPath $ do + m 0 0.5 + l (1 - r1) 0.5 + aa r1 r1 0 False True 0.5 0 + aa r1 r1 0 False True r1 0.5 + l 1 0.5 + l 1 y1 + aa r1 r1 0 False False 0.5 1 + aa r1 r1 0 False False 0 y1 + S.z + + +--------------------------------------------------------------------------------
+ src/Main.hs view
@@ -0,0 +1,129 @@+module Main where + +import System.Directory +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S + +import Core.Geometry +import Core.Render +import Core.Style +import Core.Utils +import Icons.Business (svgBusiness) +import Icons.Computer (svgComputer) +import Icons.Cosmos (svgCosmos) +import Icons.Human (svgHuman) +import Icons.Math (svgMath) +import Icons.Office (svgOffice) +import Icons.Religion (svgReligion) +import Icons.Textarea (svgTextarea) +import Icons.Tools (svgTools) +import Images.Flags (flags) +import Images.Mosaics (mosaicSample) + + + + + + +main :: IO () +main = renderAll "./svg" + + + +renderAll :: FilePath -> IO () +renderAll svgFolder = do + createDirectoryIfMissing False svgFolder + removeDirectoryRecursive svgFolder + createDirectory svgFolder + renderIcons (svgFolder ++ "/icons/") + createDirectory (svgFolder ++ "/images") + renderFlags (svgFolder ++ "/images/flags/") + renderMosaics (svgFolder ++ "/images/mosaics/") + renderTest (svgFolder ++ "/test/") (starRegular 7 0.9 (0,0)) + putStrLn "Svg files compiled correctly" + + + +renderIcons :: FilePath -> IO () +renderIcons path = + do + createDirectory path + createDirectory businessPath + createDirectory computerPath + createDirectory cosmosPath + createDirectory humanPath + createDirectory mathPath + createDirectory officePath + createDirectory religionPath + createDirectory textareaPath + createDirectory toolsPath + renderSvgFiles businessPath (map fillIcons svgBusiness) + renderSvgFiles businessPath (map fullIcons svgBusiness) + renderSvgFiles businessPath (map strkIcons svgBusiness) + renderSvgFiles computerPath (map fillIcons svgComputer) + renderSvgFiles computerPath (map fullIcons svgComputer) + renderSvgFiles computerPath (map strkIcons svgComputer) + renderSvgFiles cosmosPath (map fillIcons svgCosmos) + renderSvgFiles cosmosPath (map fullIcons svgCosmos) + renderSvgFiles cosmosPath (map strkIcons svgCosmos) + renderSvgFiles humanPath (map fillIcons svgHuman) + renderSvgFiles humanPath (map fullIcons svgHuman) + renderSvgFiles humanPath (map strkIcons svgHuman) + renderSvgFiles mathPath (map fillIcons svgMath) + renderSvgFiles mathPath (map fullIcons svgMath) + renderSvgFiles mathPath (map strkIcons svgMath) + renderSvgFiles officePath (map fillIcons svgOffice) + renderSvgFiles officePath (map fullIcons svgOffice) + renderSvgFiles officePath (map strkIcons svgOffice) + renderSvgFiles religionPath (map fillIcons svgReligion) + renderSvgFiles religionPath (map fullIcons svgReligion) + renderSvgFiles religionPath (map strkIcons svgReligion) + renderSvgFiles textareaPath (map fillIcons svgTextarea) + renderSvgFiles textareaPath (map fullIcons svgTextarea) + renderSvgFiles textareaPath (map strkIcons svgTextarea) + renderSvgFiles toolsPath (map fillIcons svgTools) + renderSvgFiles toolsPath (map fullIcons svgTools) + renderSvgFiles toolsPath (map strkIcons svgTools) + where + fillIcons (a,b) = (a ++ "_fill" , stdDims $ fillStyle b) + fullIcons (a,b) = (a ++ "_full" , stdDims $ fullStyle b) + strkIcons (a,b) = (a ++ "_strk" , stdDims $ strkStyle b) + -- test (a,b) = (a, coreSvg def $ b >> frame (-1) (-1) 2 2) + businessPath = path ++ "business/" + computerPath = path ++ "computer/" + cosmosPath = path ++ "cosmos/" + humanPath = path ++ "human/" + mathPath = path ++ "math/" + officePath = path ++ "office/" + religionPath = path ++ "religion/" + textareaPath = path ++ "textarea/" + toolsPath = path ++ "tools/" + + + +renderFlags :: FilePath -> IO () +renderFlags path = do + createDirectory path + renderSvgFiles path flags + + + +renderMosaics :: FilePath -> IO () +renderMosaics path = do + createDirectory path + renderSvgFiles path mosaicSample + + + +renderTest :: FilePath -> Svg -> IO () +renderTest path svgTest = do + createDirectory path + renderSvgFiles path test + where + test = + [ (,) "test_fill" (stdDims $ fillStyle svgFramed) + , (,) "test_full" (stdDims $ fullStyle svgFramed) + , (,) "test_strk" (stdDims $ strkStyle svgFramed) + ] + svgFramed = + S.g $ svgTest >> frame (-1) (-1) 2 2
+ svg-icons.cabal view
@@ -0,0 +1,97 @@+cabal-version: 2.4 +name: svg-icons +version: 0.1.0.0 +homepage: https://github.com/RamiroPastor/SvgIcons +license: BSD-3-Clause +license-file: LICENSE +author: Ramiro +maintainer: ramir659@icloud.com +copyright: (c) Ramiro +category: Graphics, Web + +synopsis: Svg Icons and more + +description: + Svg icons made with the blaze-svg package. + You can use them in your Haskell project or use the rendering module + to get standalone svg files or React (jsx) files. + + + +-- extra-source-files: CHANGELOG.md + +source-repository head + type: git + location: https://github.com/RamiroPastor/SvgIcons + +library + exposed-modules: + Core.Geometry, + Core.Render, + Core.Style, + Core.Utils, + Icons.Business, + Icons.Computer, + Icons.Cosmos, + Icons.Human, + Icons.Math, + Icons.Office, + Icons.Religion, + Icons.Textarea, + Icons.Tools, + Images.Flags, + Images.FlagsCoA, + Images.Mosaics, + Main + + -- Modules included in this library but not exported. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + -- other-extensions: + build-depends: + base >=4.15.0.0 && <5.0.0, + blaze-markup >=0.5 && <0.9, + blaze-svg >= 0.3.3.0 && < 1.0, + directory >= 1.3.7.0 && <2.0.0, + text >= 2.0 && < 3.0 + hs-source-dirs: src + default-language: Haskell2010 + +executable SvgIcons-exe + default-language: Haskell2010 + hs-source-dirs: src + main-is: Main.hs + build-depends: + base >=4.15.0.0 && <5.0.0, + blaze-markup >=0.5 && <0.9, + blaze-svg >= 0.3.3.0 && < 1.0, + directory >= 1.3.7.0 && <2.0.0, + text >= 2.0 && < 3.0 + other-modules: + Core.Geometry, + Core.Render, + Core.Style, + Core.Utils, + Icons.Business, + Icons.Computer, + Icons.Cosmos, + Icons.Human, + Icons.Math, + Icons.Office, + Icons.Religion, + Icons.Textarea, + Icons.Tools, + Images.Flags, + Images.FlagsCoA, + Images.Mosaics + + +-- test-suite SvgIcons-test +-- default-language: Haskell2010 +-- type: exitcode-stdio-1.0 +-- hs-source-dirs: test +-- main-is: TestRender.hs +-- build-depends: +-- base ^>=4.15.0.0, +-- SvgIcons