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

48 lines
1.1 KiB
Haskell
Raw Normal View History

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
-- gi-gdk
import qualified GI.Gdk as GDK
-- MetaBrush
import MetaBrush.Render.Util
( withRGBA )
--------------------------------------------------------------------------------
-- | "Selection" mouse cursor. 18 x 18.
drawCursor :: GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool
drawCursor cursorColour outlineColour = do
Cairo.setLineWidth 1
withRGBA outlineColour Cairo.setSourceRGBA
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
withRGBA cursorColour Cairo.setSourceRGBA
Cairo.fillPreserve
pure True
-- | "Selection" tool icon. 30 x 30.
drawCursorIcon :: GDK.RGBA -> Cairo.Render Bool
drawCursorIcon cursorColour = do
withRGBA cursorColour Cairo.setSourceRGBA
Cairo.newPath
Cairo.moveTo 24.023438 16.3125
Cairo.curveTo 15.636719 16.9375 13.699219 18.40625 8.742188 25.261719
Cairo.lineTo 8.835938 3.503906
Cairo.closePath
Cairo.fillPreserve
pure True