mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-06 07:13:37 +00:00
48 lines
1.1 KiB
Haskell
48 lines
1.1 KiB
Haskell
|
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
|