metabrush/src/app/MetaBrush/Asset/Cursor.hs

49 lines
1.2 KiB
Haskell
Raw Normal View History

2020-08-07 22:41:08 +00:00
{-# LANGUAGE NamedFieldPuns #-}
2020-08-07 19:39:24 +00:00
module MetaBrush.Asset.Cursor
( drawCursor, drawCursorIcon )
where
-- gi-cairo-render
import qualified GI.Cairo.Render as Cairo
-- MetaBrush
2020-08-07 22:41:08 +00:00
import MetaBrush.Asset.Colours
( ColourRecord(..), Colours )
2020-09-01 19:56:59 +00:00
import MetaBrush.Util
2020-08-07 19:39:24 +00:00
( withRGBA )
--------------------------------------------------------------------------------
-- | "Selection" mouse cursor. 18 x 18.
2020-08-07 22:41:08 +00:00
drawCursor :: Colours -> Cairo.Render Bool
drawCursor ( Colours { cursor, cursorOutline } ) = do
2020-08-07 19:39:24 +00:00
Cairo.setLineWidth 1
2020-08-07 22:41:08 +00:00
withRGBA cursorOutline Cairo.setSourceRGBA
2020-08-07 19:39:24 +00:00
Cairo.newPath
Cairo.moveTo 12.625 10.582031
Cairo.curveTo 5.699219 11.101563 4.097656 12.3125 0 17.976563
Cairo.lineTo 0.078125 0
Cairo.closePath
Cairo.strokePreserve
2020-08-07 22:41:08 +00:00
withRGBA cursor Cairo.setSourceRGBA
2020-08-07 19:39:24 +00:00
Cairo.fillPreserve
pure True
2020-08-07 22:41:08 +00:00
-- | "Selection" tool icon. 40 x 40.
drawCursorIcon :: Colours -> Cairo.Render Bool
drawCursorIcon ( Colours { cursor } ) = do
2020-08-07 19:39:24 +00:00
2020-08-07 22:41:08 +00:00
withRGBA cursor Cairo.setSourceRGBA
2020-08-07 19:39:24 +00:00
Cairo.newPath
2020-08-07 22:41:08 +00:00
Cairo.moveTo 29.035156 22.058594
Cairo.curveTo 20.089844 22.722656 18.023438 24.289063 12.734375 31.605469
Cairo.lineTo 12.835938 8.394531
2020-08-07 19:39:24 +00:00
Cairo.closePath
Cairo.fillPreserve
pure True