{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} module MetaBrush.Asset.Tools ( drawBrush, drawMeta, drawPath, drawPen ) where -- gi-cairo-render import qualified GI.Cairo.Render as Cairo -- MetaBrush import MetaBrush.Asset.Colours ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | Calligraphy brush icon. Width = 40 height = 40. drawBrush :: Colours -> Cairo.Render Bool drawBrush ( Colours { base, splash } ) = do -- Loop Cairo.newPath Cairo.moveTo 29.957031 6.425781 Cairo.curveTo 29.101563 7.550781 27.472656 6.492188 26.386719 8.589844 Cairo.curveTo 27.082031 6.519531 25.195313 6.105469 25.730469 4.472656 Cairo.curveTo 26.195313 3.050781 27.214844 1.808594 29.230469 2.910156 Cairo.curveTo 30.773438 3.757813 31.101563 4.917969 29.957031 6.425781 Cairo.closePath Cairo.setLineWidth 1 withRGBA base Cairo.setSourceRGBA Cairo.strokePreserve -- Brush body Cairo.newPath Cairo.moveTo 26.722656 8.613281 Cairo.curveTo 27.296875 8.8125 28.105469 9.488281 27.792969 10.007813 Cairo.lineTo 21.464844 20.125 Cairo.lineTo 21.542969 25.960938 Cairo.curveTo 20.449219 26.472656 17.285156 25.222656 16.144531 24.730469 Cairo.curveTo 15.003906 24.238281 13.246094 22.574219 13.683594 22.15625 Cairo.lineTo 18.425781 19.203125 Cairo.lineTo 24.394531 8.492188 Cairo.curveTo 24.691406 7.964844 25.261719 7.804688 25.777344 8.117188 Cairo.closePath withRGBA splash Cairo.setSourceRGBA Cairo.fillPreserve -- Brush tip Cairo.newPath Cairo.moveTo 15.324219 27.53125 Cairo.curveTo 16.480469 28.0625 17.847656 28.539063 18.835938 28.609375 Cairo.curveTo 18.835938 28.609375 12.730469 35.265625 12.730469 35.265625 Cairo.curveTo 11.882813 36.382813 9.226563 38.167969 8.9375 37.984375 Cairo.curveTo 8.671875 37.820313 9.160156 35.5625 9.738281 33.875 Cairo.curveTo 9.738281 33.875 12.515625 25.789063 12.515625 25.789063 Cairo.curveTo 12.929688 26.230469 14.167969 26.996094 15.324219 27.53125 Cairo.curveTo 15.324219 27.53125 15.324219 27.53125 15.324219 27.53125 Cairo.closePath withRGBA base Cairo.setSourceRGBA Cairo.fillPreserve pure True -- | MetaParameter icon. Width = 40 height = 40. drawMeta :: Colours -> Cairo.Render Bool drawMeta ( Colours { splash } ) = do Cairo.newPath Cairo.moveTo 20.96875 16.375 Cairo.curveTo 19.3125 13.929688 17.671875 8.941406 16.617188 9.160156 Cairo.curveTo 16.046875 8.984375 4.667969 25.808594 3.65625 26.996094 Cairo.curveTo 2.515625 25.808594 0.976563 27.082031 0.847656 28.882813 Cairo.curveTo 0.847656 29.804688 3.082031 32.371094 5.019531 29.585938 Cairo.curveTo 5.203125 29.324219 13.851563 17.222656 14.65625 16.039063 Cairo.curveTo 15.359375 17.488281 18.269531 22.5625 18.445313 22.785156 Cairo.curveTo 20.15625 21.925781 20.546875 21.410156 21.46875 20.3125 Cairo.curveTo 22.523438 18.851563 22.664063 18.667969 24.082031 16.800781 Cairo.curveTo 24.742188 18.164063 26.789063 20.410156 28.652344 22.820313 Cairo.curveTo 29.355469 23.730469 32.359375 26.8125 33.242188 26.46875 Cairo.curveTo 33.710938 26.285156 35.382813 24.777344 35.679688 23.179688 Cairo.curveTo 35.746094 22.820313 35.914063 21.457031 35.609375 21.183594 Cairo.curveTo 35.394531 20.988281 33.601563 22 33.042969 21.777344 Cairo.curveTo 32.074219 20.359375 30.890625 17.894531 29.867188 16.191406 Cairo.curveTo 28.242188 13.25 26.972656 9.632813 25.664063 10.433594 Cairo.curveTo 24.757813 10.992188 24.238281 11.683594 24.039063 11.972656 Cairo.curveTo 23.128906 13.292969 22.699219 13.945313 20.96875 16.375 Cairo.curveTo 20.96875 16.375 20.96875 16.375 20.96875 16.375 Cairo.closePath withRGBA splash Cairo.setSourceRGBA Cairo.fillPreserve pure True -- | Path icon. Width = 40 height = 40. drawPath :: Colours -> Cairo.Render Bool drawPath ( Colours { .. } ) = do Cairo.setLineCap Cairo.LineCapRound Cairo.setLineJoin Cairo.LineJoinMiter -- Path Cairo.newPath Cairo.moveTo 7.226563 15.027344 Cairo.curveTo 26.421875 10.488281 30.699219 15.492188 27.621094 31.34375 Cairo.setLineWidth 4 withRGBA path Cairo.setSourceRGBA Cairo.stroke -- Control point and connecting lines Cairo.newPath Cairo.moveTo 35.660156 8.5 Cairo.curveTo 35.660156 10.75 33.835938 12.574219 31.585938 12.574219 Cairo.curveTo 29.335938 12.574219 27.511719 10.75 27.511719 8.5 Cairo.curveTo 27.511719 6.25 29.335938 4.425781 31.585938 4.425781 Cairo.curveTo 33.835938 4.425781 35.660156 6.25 35.660156 8.5 Cairo.closePath Cairo.setLineWidth 1.5 withRGBA controlPoint Cairo.setSourceRGBA Cairo.fillPreserve withRGBA controlPointOutline Cairo.setSourceRGBA Cairo.stroke withRGBA controlPoint Cairo.setSourceRGBA Cairo.setLineWidth 2 Cairo.newPath Cairo.moveTo 7.179688 14.882813 Cairo.lineTo 31.820313 8.4375 Cairo.stroke Cairo.newPath Cairo.moveTo 27.414063 31.332031 Cairo.lineTo 31.691406 8.421875 Cairo.stroke Cairo.setLineWidth 1.5 -- Path points Cairo.newPath Cairo.moveTo 11.042969 12.636719 Cairo.lineTo 11.042969 17.09375 Cairo.lineTo 7.179688 19.324219 Cairo.lineTo 3.316406 17.09375 Cairo.lineTo 3.316406 12.636719 Cairo.lineTo 7.179688 10.40625 Cairo.closePath withRGBA pathPoint Cairo.setSourceRGBA Cairo.fillPreserve withRGBA pathPointOutline Cairo.setSourceRGBA Cairo.stroke Cairo.newPath Cairo.moveTo 31.269531 28.988281 Cairo.lineTo 31.269531 33.449219 Cairo.lineTo 27.40625 35.679688 Cairo.lineTo 23.546875 33.449219 Cairo.lineTo 23.546875 28.988281 Cairo.lineTo 27.40625 26.761719 Cairo.closePath withRGBA pathPoint Cairo.setSourceRGBA Cairo.fillPreserve withRGBA pathPointOutline Cairo.setSourceRGBA Cairo.stroke pure True -- | Pen icon. Width = 40 height = 40. drawPen :: Colours -> Cairo.Render Bool drawPen ( Colours { base, splash } ) = do withRGBA base Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 24.480469 16.863281 Cairo.lineTo 19.988281 14.269531 Cairo.curveTo 16.316406 20.628906 15.089844 20.941406 13.644531 21.570313 Cairo.curveTo 12.195313 22.195313 12.871094 23.601563 12.871094 23.601563 Cairo.curveTo 13.957031 25.621094 12.503906 29.265625 12.25 30.207031 Cairo.curveTo 11.898438 30.246094 11.398438 30.492188 11.207031 30.820313 Cairo.curveTo 10.921875 31.316406 11.453125 32.253906 11.867188 32.613281 Cairo.lineTo 12.710938 31.144531 Cairo.lineTo 12.90625 30.800781 Cairo.lineTo 16.179688 25.09375 Cairo.curveTo 16.179688 25.09375 15.855469 24.117188 16.128906 23.5625 Cairo.curveTo 16.398438 23.003906 17.054688 22.324219 18.019531 22.882813 Cairo.curveTo 18.984375 23.4375 18.726563 24.347656 18.375 24.859375 Cairo.curveTo 18.027344 25.371094 17.011719 25.574219 17.011719 25.574219 Cairo.lineTo 13.742188 31.28125 Cairo.lineTo 13.542969 31.625 Cairo.lineTo 12.703125 33.09375 Cairo.curveTo 13.222656 33.285156 14.355469 33.460938 14.644531 32.964844 Cairo.curveTo 14.847656 32.609375 14.796875 32.027344 14.625 31.6875 Cairo.curveTo 16.632813 29.617188 18.609375 28.128906 20.011719 27.804688 Cairo.curveTo 21.449219 27.46875 21.308594 26.394531 21.308594 26.394531 Cairo.curveTo 21.179688 22.230469 24.476563 16.863281 24.476563 16.863281 Cairo.closePath Cairo.fillPreserve withRGBA splash Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 23.878906 6.710938 Cairo.lineTo 21.644531 10.582031 Cairo.lineTo 21.109375 10.273438 Cairo.curveTo 20.601563 9.980469 19.816406 10.390625 19.523438 10.898438 Cairo.curveTo 19.230469 11.40625 19.542969 11.816406 20.046875 12.113281 Cairo.lineTo 26.375 15.765625 Cairo.curveTo 26.882813 16.058594 27.394531 16.121094 27.6875 15.613281 Cairo.curveTo 27.980469 15.105469 27.945313 14.21875 27.4375 13.925781 Cairo.lineTo 26.640625 13.464844 Cairo.lineTo 28.875 9.597656 Cairo.closePath Cairo.fillPreserve pure True