metabrush/src/app/MetaBrush/Asset/WindowIcons.hs
2020-08-08 00:41:08 +02:00

108 lines
2.6 KiB
Haskell

{-# LANGUAGE NamedFieldPuns #-}
module MetaBrush.Asset.WindowIcons
( drawMinimise, drawRestoreDown, drawMaximise, drawClose )
where
-- gi-cairo-render
import qualified GI.Cairo.Render as Cairo
-- MetaBrush
import MetaBrush.Asset.Colours
( ColourRecord(..), Colours )
import MetaBrush.Render.Util
( withRGBA )
--------------------------------------------------------------------------------
-- | Minimise window icon.
drawMinimise :: Colours -> Cairo.Render Bool
drawMinimise ( Colours { plain } ) = do
withRGBA plain Cairo.setSourceRGBA
Cairo.newPath
Cairo.moveTo 6.144531 12.914063
Cairo.lineTo 6.144531 16.675781
Cairo.lineTo 17.855469 16.675781
Cairo.lineTo 17.855469 12.914063
Cairo.closePath
Cairo.fillPreserve
pure True
-- | Restore down window icon.
drawRestoreDown :: Colours -> Cairo.Render Bool
drawRestoreDown ( Colours { plain } ) = do
withRGBA plain Cairo.setSourceRGBA
Cairo.newPath
Cairo.moveTo 8.453125 4.179688
Cairo.lineTo 8.453125 9.230469
Cairo.lineTo 4.941406 9.230469
Cairo.lineTo 4.941406 19.105469
Cairo.lineTo 15.8125 19.105469
Cairo.lineTo 15.8125 14.761719
Cairo.lineTo 19.324219 14.761719
Cairo.lineTo 19.324219 4.179688
Cairo.closePath
Cairo.moveTo 9.988281 7.261719
Cairo.lineTo 17.773438 7.261719
Cairo.lineTo 17.773438 13.238281
Cairo.lineTo 15.8125 13.238281
Cairo.lineTo 15.8125 9.230469
Cairo.lineTo 9.988281 9.230469
Cairo.closePath
Cairo.moveTo 6.476563 12.316406
Cairo.lineTo 14.261719 12.316406
Cairo.lineTo 14.261719 17.597656
Cairo.lineTo 6.476563 17.597656
Cairo.closePath
Cairo.fillPreserve
pure True
-- | Maximise window icon.
drawMaximise :: Colours -> Cairo.Render Bool
drawMaximise ( Colours { plain } ) = do
withRGBA plain Cairo.setSourceRGBA
Cairo.newPath
Cairo.moveTo 5.386719 5.449219
Cairo.lineTo 5.386719 18.550781
Cairo.lineTo 18.613281 18.550781
Cairo.lineTo 18.613281 5.449219
Cairo.closePath
Cairo.moveTo 6.921875 9.128906
Cairo.lineTo 17.078125 9.128906
Cairo.lineTo 17.078125 17.023438
Cairo.lineTo 6.921875 17.023438
Cairo.closePath
Cairo.fillPreserve
pure True
-- | Close window icon.
drawClose :: Colours -> Cairo.Render Bool
drawClose ( Colours { plain } ) = do
Cairo.setLineWidth 2
withRGBA plain Cairo.setSourceRGBA
Cairo.setLineCap Cairo.LineCapRound
Cairo.setLineJoin Cairo.LineJoinMiter
Cairo.newPath
Cairo.moveTo 6.132813 6.238281
Cairo.lineTo 17.867188 17.761719
Cairo.strokePreserve
Cairo.newPath
Cairo.moveTo 6.132813 17.761719
Cairo.lineTo 17.867188 6.23828
Cairo.strokePreserve
pure True