{-# LANGUAGE NamedFieldPuns #-} module MetaBrush.Asset.Cursor ( drawCursor, drawCursorIcon ) where -- gi-cairo-render import qualified GI.Cairo.Render as Cairo -- MetaBrush import MetaBrush.Asset.Colours ( ColourRecord(..), Colours ) import MetaBrush.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | "Selection" mouse cursor. 18 x 18. drawCursor :: Colours -> Cairo.Render Bool drawCursor ( Colours { cursor, cursorOutline } ) = do Cairo.setLineWidth 1 withRGBA cursorOutline 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 cursor Cairo.setSourceRGBA Cairo.fillPreserve pure True -- | "Selection" tool icon. 40 x 40. drawCursorIcon :: Colours -> Cairo.Render Bool drawCursorIcon ( Colours { cursor } ) = do withRGBA cursor Cairo.setSourceRGBA Cairo.newPath 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 Cairo.closePath Cairo.fillPreserve pure True