diff --git a/MetaBrush.cabal b/MetaBrush.cabal index 622a6a1..dd35262 100644 --- a/MetaBrush.cabal +++ b/MetaBrush.cabal @@ -83,13 +83,12 @@ executable MetaBrush Main.hs other-modules: - MetaBrush.Asset.Brush - , MetaBrush.Asset.Colours + MetaBrush.Asset.Colours , MetaBrush.Asset.Cursor , MetaBrush.Asset.Logo , MetaBrush.Asset.Magnifier - , MetaBrush.Asset.Meta , MetaBrush.Asset.TickBox + , MetaBrush.Asset.Tools , MetaBrush.Asset.WindowIcons , MetaBrush.Document , MetaBrush.Event diff --git a/app/Main.hs b/app/Main.hs index 86eef31..ae0fbdd 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -39,16 +39,14 @@ import qualified Data.Text as Text ( pack ) -- MetaBrush -import MetaBrush.Asset.Brush - ( drawBrush ) import MetaBrush.Asset.Colours - ( ColourRecord(..), colours ) + ( ColourRecord(..), getColours ) import MetaBrush.Asset.Cursor ( drawCursorIcon ) import MetaBrush.Asset.Logo ( drawLogo ) -import MetaBrush.Asset.Meta - ( drawMeta ) +import MetaBrush.Asset.Tools + ( drawBrush, drawMeta, drawPath, drawPen ) import MetaBrush.Asset.WindowIcons ( drawMinimise, drawRestoreDown, drawMaximise, drawClose ) import MetaBrush.Event @@ -99,7 +97,7 @@ main = do iconPath <- Directory.canonicalizePath =<< Cabal.getDataFileName "icon.png" GTK.windowSetIconFromFile window iconPath - Colours { .. } <- colours windowWidgetPath + colours <- getColours windowWidgetPath --------------------------------------------------------- -- Create base UI elements @@ -148,8 +146,7 @@ main = do GTK.boxPackStart logo logoArea True True 0 void $ GTK.onWidgetDraw logoArea - $ Cairo.renderWithContext - ( drawLogo logo_base logo_highlight logo_base ) + $ Cairo.renderWithContext ( drawLogo colours ) --------------------------------------------------------- -- Title bar @@ -200,18 +197,18 @@ main = do void $ GTK.onWidgetDraw minimiseArea $ Cairo.renderWithContext - ( drawMinimise plain ) + ( drawMinimise colours ) void $ GTK.onWidgetDraw fullscreenArea \ cairoContext -> do Just gdkWindow <- GTK.widgetGetWindow window windowState <- GDK.windowGetState gdkWindow if any ( \case { GDK.WindowStateFullscreen -> True; GDK.WindowStateMaximized -> True; _ -> False } ) windowState - then Cairo.renderWithContext ( drawRestoreDown plain ) cairoContext - else Cairo.renderWithContext ( drawMaximise plain ) cairoContext + then Cairo.renderWithContext ( drawRestoreDown colours ) cairoContext + else Cairo.renderWithContext ( drawMaximise colours ) cairoContext void $ GTK.onWidgetDraw closeArea $ Cairo.renderWithContext - ( drawClose plain ) + ( drawClose colours ) for_ [ minimiseButton, fullscreenButton, closeButton ] \ button -> do @@ -227,21 +224,37 @@ main = do GTK.widgetSetValign toolBar GTK.AlignStart GTK.widgetSetVexpand toolBar True - toolBarPhantomRadioButton <- GTK.radioButtonNew ( [] @GTK.RadioButton ) + selectionTool <- GTK.radioButtonNew ( [] @GTK.RadioButton ) + penTool <- GTK.radioButtonNewFromWidget ( Just selectionTool ) - selectionTool <- GTK.radioButtonNewFromWidget ( Just toolBarPhantomRadioButton ) - brushTool <- GTK.radioButtonNewFromWidget ( Just toolBarPhantomRadioButton ) - metaTool <- GTK.radioButtonNewFromWidget ( Just toolBarPhantomRadioButton ) + pathTool <- GTK.radioButtonNew ( [] @GTK.RadioButton ) + brushTool <- GTK.radioButtonNewFromWidget ( Just pathTool ) + metaTool <- GTK.radioButtonNewFromWidget ( Just pathTool ) + + toolSep1 <- GTK.boxNew GTK.OrientationVertical 0 GTK.boxPackStart toolBar selectionTool True True 0 + GTK.boxPackStart toolBar penTool True True 0 + GTK.boxPackStart toolBar toolSep1 True True 0 + GTK.boxPackStart toolBar pathTool True True 0 GTK.boxPackStart toolBar brushTool True True 0 GTK.boxPackStart toolBar metaTool True True 0 - for_ [ selectionTool, brushTool, metaTool ] \ tool -> do + for_ [ selectionTool, penTool, pathTool, brushTool, metaTool ] \ tool -> do GTK.toggleButtonSetMode tool False -- don't display radio indicator widgetAddClass tool "toolItem" + widgetAddClass toolSep1 "toolBarSeparator" + + GTK.widgetSetTooltipText selectionTool ( Just "Select" ) + GTK.widgetSetTooltipText penTool ( Just "Draw" ) + GTK.widgetSetTooltipText pathTool ( Just "Brush path" ) + GTK.widgetSetTooltipText brushTool ( Just "Brushes" ) + GTK.widgetSetTooltipText metaTool ( Just "Meta-parameters" ) + selectionToolArea <- GTK.drawingAreaNew + penToolArea <- GTK.drawingAreaNew + pathToolArea <- GTK.drawingAreaNew brushToolArea <- GTK.drawingAreaNew metaToolArea <- GTK.drawingAreaNew @@ -252,20 +265,30 @@ main = do -} GTK.containerAdd selectionTool selectionToolArea + GTK.containerAdd penTool penToolArea + GTK.containerAdd pathTool pathToolArea GTK.containerAdd brushTool brushToolArea GTK.containerAdd metaTool metaToolArea void $ GTK.onWidgetDraw selectionToolArea $ Cairo.renderWithContext - ( drawCursorIcon logo_base ) + ( drawCursorIcon colours ) + + void $ GTK.onWidgetDraw penToolArea + $ Cairo.renderWithContext + ( drawPen colours ) + + void $ GTK.onWidgetDraw pathToolArea + $ Cairo.renderWithContext + ( drawPath colours ) void $ GTK.onWidgetDraw brushToolArea $ Cairo.renderWithContext - ( drawBrush logo_base logo_highlight logo_base ) + ( drawBrush colours ) void $ GTK.onWidgetDraw metaToolArea $ Cairo.renderWithContext - ( drawMeta logo_highlight ) + ( drawMeta colours ) --------------------------------------------------------- -- File bar @@ -297,9 +320,9 @@ main = do -- Make both file tab elements activate styling on the whole tab -- (e.g. hovering over the close file button should highlight the whole tab). void $ GTK.onButtonClicked pgButton do - active <- GTK.toggleButtonGetActive pgButton + isActive <- GTK.toggleButtonGetActive pgButton flags <- GTK.widgetGetStateFlags tab - if active + if isActive then GTK.widgetSetStateFlags tab ( GTK.StateFlagsActive : flags ) True else GTK.widgetSetStateFlags tab ( filter ( /= GTK.StateFlagsActive ) flags ) True @@ -324,7 +347,7 @@ main = do --------------------------------------------------------- -- Main viewport - widgetAddClass viewportGrid "viewport_bg" + widgetAddClass viewportGrid "viewport" rvRulerCorner <- GTK.revealerNew rvLeftRuler <- GTK.revealerNew @@ -374,8 +397,8 @@ main = do GTK.widgetSetHexpand viewportOverlay True GTK.widgetSetVexpand viewportOverlay True - viewport <- GTK.drawingAreaNew - GTK.setContainerChild viewportOverlay viewport + viewportArea <- GTK.drawingAreaNew + GTK.setContainerChild viewportOverlay viewportArea viewportScrollbarGrid <- GTK.gridNew GTK.overlayAddOverlay viewportOverlay viewportScrollbarGrid diff --git a/assets/theme.css b/assets/theme.css index 6a74990..84a5b6a 100644 --- a/assets/theme.css +++ b/assets/theme.css @@ -2,25 +2,85 @@ all: unset; } +/* Colors parsed by application */ +.bg { + background-color: rgb(41, 40, 40); +} +.active { + background-color: rgb(72,70,61); +} +.highlight { + color: rgb(234,223,204) +} +.cursor { + color:rgb(234,223,204); +} +.cursorStroke { + color: black; +} +.plain { + color: rgb(212, 190, 152); +} +.base { + color: rgb(234, 223, 204); +} +.splash { + color: rgb(245, 136, 27); +} +.pathPoint { + color: rgb(129, 131, 241); +} +.pathPointStroke { + color: black; +} +.controlPoint { + color: rgb(161,221,233); +} +.controlPointStroke { + color: black; +} +.path { + color: rgb(184,80,80); +} +.brushStroke { + color: rgb(235,118,219); +} +.viewport { + background-color: rgb(236, 223, 210); + -GtkWidget-window-dragging: false; +} +.viewportScrollbar { + background-color: rgba(45, 39, 39, 0.66); + margin: 4px; + min-width: 8px; + min-height: 8px; +} +.tabScrollbar { + background-color: rgba(48, 45, 38, 0.66); +} +.magnifier { + color: rgb(236, 223, 210); +} +.glass { + color: rgba(156, 231, 255, 0.5); +} + + + +/* Proper CSS styling */ + +/* GTK tooltips */ +tooltip { + color: rgb(212, 190, 152); + background-color: rgb(41, 40, 40); + border: 1px solid rgb(28,25,25); +} + .window { -GtkWidget-window-dragging: true; } -/* Window background colour */ -.bg { - background-color: rgb(41, 40, 40); -} - -/* Viewport background colour */ -.viewport_bg { - background-color: rgb(236, 223, 210); - -GtkWidget-window-dragging: false; -} - /* Basic text colour */ -.plain { - color: rgb(212, 190, 152); -} /* Basic text font */ .text { @@ -58,19 +118,6 @@ color: rgb(245, 136, 27); } -/* Viewport scrollbar colour */ -.viewportScrollbar { - color: purple; /* debugging */ - background-color: rgba(45, 39, 39, 0.66); - margin: 4px; - min-width: 8px; - min-height: 8px; -} - -/* Tab scrollbar colour */ -.tabScrollbar { - background-color: rgba(48, 45, 38, 0.66); -} /* Rulers */ .ruler { @@ -80,15 +127,7 @@ background-size: 16px 16px; } -/* Magnifying glass base colour */ -.magnifier { - color: rgb(236, 223, 210); -} -/* Magnifying glass glass colour */ -.glass { - color: rgba(156, 231, 255, 0.5); -} /* Cursor colour */ .cursor { @@ -202,13 +241,23 @@ margin-top: 28px; } +.toolBarSeparator { + min-height: 2px; + margin-left: 10px; + margin-right: 10px; + margin-top: 4px; + margin-bottom: 4px; + background-color: rgb(72,70,61); +} + .toolItem { border-left: 2px solid rgb(41, 40, 40); - min-height: 32px; - min-width: 38px; - padding-top: 12px; + min-height: 40px; + min-width: 40px; + padding-top: 8px; padding-bottom: 8px; - padding-left: 6px; + padding-left: 3px; + padding-right: 3px; } .toolItem:hover { diff --git a/img/MetaBrush_ui_mockup.svg b/img/MetaBrush_ui_mockup.svg index 5a1aeb8..e156bef 100644 --- a/img/MetaBrush_ui_mockup.svg +++ b/img/MetaBrush_ui_mockup.svg @@ -8,66 +8,66 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="MetaBrush_ui_mockup.svg" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)" - id="svg6301" - version="1.1" - viewBox="0 0 379.03928 233.0961" + width="379.03928mm" height="233.0961mm" - width="379.03928mm"> + viewBox="0 0 379.03928 233.0961" + version="1.1" + id="svg6301" + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" + sodipodi:docname="MetaBrush_ui_mockup.svg"> + gradientUnits="userSpaceOnUse" + x2="1102.5" + gradientTransform="matrix(-0.49057622,0,0,0.63523387,454.33888,70.55392)" + y1="51.727001" + x1="102.37"> + offset="0" /> + offset="1" /> + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4142136" + inkscape:cx="385.83839" + inkscape:cy="253.70522" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + showguides="true" + inkscape:guide-bbox="true" + inkscape:window-width="2560" + inkscape:window-height="1377" + inkscape:window-x="2552" + inkscape:window-y="115" + inkscape:window-maximized="1" + objecttolerance="1" + gridtolerance="1" + guidetolerance="1" + inkscape:snap-global="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:document-rotation="0" + inkscape:lockguides="false"> + type="xygrid" + id="grid4274" /> @@ -82,4765 +82,5511 @@ + id="layer1" + transform="translate(162.74701,208.59428)" + style="display:inline"> + width="376.24951" + height="233.0961" + x="-160.10944" + y="-208.59428" /> + width="284.3801" + height="207.51059" + x="-142.20148" + y="-193.19513" /> - + - - + + + d="m -456.53382,142.09355 c 1.35241,-2.68868 0.84006,-10.09314 -4.71032,-14.49525 -2.13976,-1.69708 -4.74824,-4.21569 -1.65878,-6.95569 3.08947,-2.74 3.48055,-2.54483 5.01169,-4.02742 1.53113,-1.48259 3.26744,-3.56987 4.03384,-5.37484 0.7664,-1.80496 2.41015,-4.52247 2.49753,-8.10512 0.0874,-3.582647 -3.17059,-5.605017 -6.377,-6.450637 -3.20643,-0.84562 -7.73303,-0.11864 -8.67159,-0.19624 -4.76339,-0.39358 -1.85517,7.211567 -0.0236,7.299657 1.52783,0.0735 6.49647,0.0472 7.08706,0.18899 0.59059,0.14174 3.26363,0.0493 2.66946,2.33873 -0.59418,2.28962 -3.8614,4.87109 -5.59152,6.39285 -1.73013,1.52175 -5.35577,4.51109 -7.02169,6.77819 -1.66592,2.2671 0.25235,7.29881 1.46653,10.10713 1.21419,2.80831 5.64033,7.18569 6.32748,9.55851 0.68716,2.37282 0.26698,7.00712 0.16537,7.31148 -0.3342,1.00093 -0.33749,1.38445 -0.29661,1.96751 0.45744,0.14688 2.20262,-0.98274 3.95211,-3.6642 0.54344,-0.83295 0.60076,-1.60145 1.14007,-2.67365 z" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sszzzzzsszzzzzzscss" /> + - - - + + + height="2.1432023" + width="2.1481743" + id="rect6860" + style="opacity:1;fill:#c6c5df;fill-opacity:1;stroke:none;stroke-width:0.00843553;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" + transform="scale(-1,1)" /> + cx="-457.59851" + cy="98.483879" + r="0.39756343" /> + cx="-451.21747" + cy="103.42836" + r="0.39756343" /> + cx="-457.79898" + cy="114.3196" + r="0.39756343" /> + cx="-472.13132" + cy="121.53588" + r="0.39756343" /> + cx="-458.03284" + cy="134.13097" + r="0.39756343" /> + id="path6862" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cssc" /> + cx="-463.01645" + cy="130.38513" + r="0.39756343" /> - + + id="path6970-5" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + sodipodi:sides="6" + sodipodi:cx="-454.87469" + sodipodi:cy="109.39917" + sodipodi:r1="0.52846414" + sodipodi:r2="0.26423207" + sodipodi:arg1="1.0471976" + sodipodi:arg2="1.5707964" + inkscape:flatsided="true" + inkscape:rounded="0" + inkscape:randomized="0" + d="m -454.61046,109.85683 -0.52847,0 -0.26423,-0.45766 0.26423,-0.45766 0.52847,0 0.26423,0.45766 z" + inkscape:transform-center-x="-0.024388327" + inkscape:transform-center-y="-0.04851186" /> + id="path6970" + inkscape:connector-curvature="0" /> - + + sodipodi:sides="6" + sodipodi:cx="-467.59613" + sodipodi:cy="125.74951" + sodipodi:r1="0.52846414" + sodipodi:r2="0.26423207" + sodipodi:arg1="1.0471976" + sodipodi:arg2="1.5707964" + inkscape:flatsided="true" + inkscape:rounded="0" + inkscape:randomized="0" + d="m -467.3319,126.20718 -0.52846,0 -0.26423,-0.45767 0.26423,-0.45766 0.52846,0 0.26423,0.45766 z" + inkscape:transform-center-x="-0.024388327" + inkscape:transform-center-y="-0.04851186" /> - - + + + id="path7017" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sscs" /> hover:hover:select: + y="145.76814" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.76389px;line-height:0.1;font-family:Caladea;-inkscape-font-specification:Caladea;fill:#dce6b4;fill-opacity:1;stroke-width:0.264583" + id="tspan7056">select: - + + id="path6866-6-0" + sodipodi:sides="6" + sodipodi:cx="-463.03705" + sodipodi:cy="143.37457" + sodipodi:r1="0.52846414" + sodipodi:r2="0.26423207" + sodipodi:arg1="1.0471976" + sodipodi:arg2="1.5707964" + inkscape:flatsided="true" + inkscape:rounded="0" + inkscape:randomized="0" + d="m -462.77282,143.83224 -0.52846,0 -0.26423,-0.45767 0.26423,-0.45766 0.52846,0 0.26424,0.45766 z" + inkscape:transform-center-x="-0.024388327" + inkscape:transform-center-y="-0.04851186" /> + + + + + hover:select: - - - - hover:select: - + cx="-473.67529" + id="circle7210" + style="opacity:1;fill:#f7ebf6;fill-opacity:1;stroke:#e3b9df;stroke-width:0.33900926;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" /> + width="22.688953" + height="29.302324" + x="-419.71521" + y="79.630135" /> Strokes + x="-419.00302" + y="84.005127" + style="font-size:4.93889px;line-height:0px;stroke-width:0.264583" + dx="0">Strokes + width="26.789129" + id="rect2113-5" + style="opacity:1;fill:#48463d;fill-opacity:1;stroke:none;stroke-width:0.463904;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.992157;paint-order:stroke fill markers" /> + width="73.892517" + height="74.624123" + x="142.21274" + y="-184.755" /> + height="9.1281252" + width="24.571112" + id="rect2113" + style="opacity:1;fill:#48463d;fill-opacity:1;stroke:none;stroke-width:0.52289164;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99215686;paint-order:stroke fill markers" /> + transform="matrix(1.5425292,0,0,1.5425292,-234.28533,-303.87821)"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccsccccssssccsscc" /> + + id="path4307" + sodipodi:nodetypes="ccccc" /> + + style="stroke-width:0.20610821;stroke-miterlimit:4;stroke-dasharray:none"> + - + id="path1755" + inkscape:connector-curvature="0" /> + id="g1776" + transform="matrix(1.9821532,0,0,1.9459556,-86.400539,-228.6369)" + style="stroke-width:0.206108;stroke-miterlimit:4;stroke-dasharray:none"> + d="m 1378.666,7.5722656 v 5.0508574 h -3.5117 v 9.876341 h 10.8697 v -4.345243 h 3.5117 V 7.5722656 Z m 1.5352,3.0839624 h 7.7838 v 5.974556 h -1.961 v -4.007661 h -5.8228 z m -3.5117,5.05281 h 7.7837 v 5.280661 h -7.7837 z" + transform="matrix(0.13348279,0,0,0.13596576,-38.35818,15.738262)" + sodipodi:nodetypes="ccccccccccccccccccccc" /> Strokes2 – MetaBrush + + + Strokes1 + Strokes2 + Strokes3 + Strokes4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Strokes + Stroke 1 + Stroke 2 + Stroke 3 + + + + + + + File + Strokes2 – MetaBrush - - - + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.35916px;font-family:Lato;-inkscape-font-specification:Lato;fill:#d4be98;fill-opacity:1;stroke-width:0.83979">Edit + View + + Brushes + View - Strokes1 + style="opacity:1;vector-effect:none;fill:#302d26;fill-opacity:0.57647059;stroke:none;stroke-width:0.49642885;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + id="rect1943-2-4" + width="70.938087" + height="1.7416537" + x="-182.82176" + y="-214.65182" + transform="rotate(90)" /> + + Strokes2 - Strokes3 + id="tspan2150" + x="145.18692" + y="-103.92428" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Lato;-inkscape-font-specification:Lato;fill:#d4be98;fill-opacity:1;stroke-width:1.05833">Transform Strokes4 - + id="tspan2158" + x="160.30167" + y="-150.67976" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Lato;-inkscape-font-specification:Lato;fill:#d4be98;fill-opacity:1;stroke-width:1.05833">Stroke 4 + + Stroke 5 + + Help + + + x: 212.12 pxy: 120.23 px + + + x: 10.05 pxy: 340.23 px + + + x: 410.12 pxy: 20.00 px + 300% + + Transform settings ... + + + + + - + id="g1946" + transform="translate(-126.94097,-120.68822)"> + id="rect2068-4-4" + d="m -124.03516,110.28909 c -0.31123,0 -0.56844,0.25723 -0.56844,0.56846 v 2.03552 c 0,0.31123 0.25721,0.56999 0.56844,0.56999 h 2.03502 c 0.31123,0 0.57051,-0.25876 0.57051,-0.56999 v -1.16478 l -0.45321,0.45371 v 0.71107 c 0,0.0686 -0.0487,0.11678 -0.1173,0.11678 h -2.03502 c -0.0686,0 -0.11731,-0.0482 -0.11731,-0.11678 v -2.03552 c 0,-0.0686 0.0487,-0.11682 0.11731,-0.11682 h 2.03502 c 0.0145,0 0.0279,0.003 0.0403,0.007 l 0.32246,-0.32244 c -0.0993,-0.083 -0.22511,-0.13592 -0.36276,-0.13592 z" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#eadfcc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45200002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> + - - - - + id="g1972" + transform="translate(-231.0545,-28.811661)"> + id="g1952" + transform="translate(98.821875,-92.934896)"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="path1948" + d="m -124.03516,111.34743 c -0.31123,0 -0.56844,0.25723 -0.56844,0.56846 v 2.03552 c 0,0.31123 0.25721,0.56999 0.56844,0.56999 h 2.03502 c 0.31123,0 0.57051,-0.25876 0.57051,-0.56999 v -1.16478 l -0.45321,0.45371 v 0.71107 c 0,0.0686 -0.0487,0.11678 -0.1173,0.11678 h -2.03502 c -0.0686,0 -0.11731,-0.0482 -0.11731,-0.11678 v -2.03552 c 0,-0.0686 0.0487,-0.11682 0.11731,-0.11682 h 2.03502 c 0.0145,0 0.0279,0.003 0.0403,0.007 l 0.32246,-0.32244 c -0.0993,-0.083 -0.22511,-0.13592 -0.36276,-0.13592 z" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#eadfcc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.45200002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="g2014" + transform="matrix(1.8144287,-0.30483094,0.30483094,1.8144287,157.64625,122.643)"> + + + + + + + + + id="path2990" + style="fill:#9ce7ff;fill-opacity:0.447581;stroke-width:0.000218732;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:stroke markers fill" + d="m 36.400521,17.373174 a 1.9885587,1.9885587 0 0 1 -1.427676,2.422905 1.9885587,1.9885587 0 0 1 -2.422906,-1.427674 1.9885587,1.9885587 0 0 1 1.427675,-2.422907 1.9885587,1.9885587 0 0 1 2.422907,1.427676" /> + id="path2" + style="fill:#ecdfd2;fill-opacity:1;stroke-width:0.0701341" + d="M 745.71289 847.36133 C 742.67337 847.25537 739.67408 848.77547 738.02148 851.58008 C 735.81903 855.31789 737.00422 860.22415 740.31836 862.83789 C 740.09434 863.25648 739.39877 864.56411 738.68359 864.1582 C 738.41428 864.00535 737.96229 864.29658 737.67188 864.80859 L 733.96289 871.19141 C 733.67359 871.70474 733.85258 872.35441 734.36328 872.64453 L 736.30078 873.74414 C 736.81328 874.03475 737.46322 873.85271 737.75391 873.3418 L 741.44922 866.78125 C 741.7402 866.26988 741.6576 865.91122 741.39258 865.75195 C 740.70108 865.33646 741.49263 864.19842 741.77148 863.70898 C 745.70555 865.47578 750.55309 864.08509 752.79297 860.2832 C 755.19674 856.20376 753.8392 850.94869 749.75977 848.54492 C 748.48506 847.79371 747.09449 847.40949 745.71289 847.36133 z M 745.40234 848.82227 A 7.1095623 7.1095623 0 0 1 752.29102 854.15234 A 7.1095623 7.1095623 0 0 1 747.18555 862.81445 A 7.1095623 7.1095623 0 0 1 738.52344 857.71094 A 7.1095623 7.1095623 0 0 1 743.62695 849.04688 A 7.1095623 7.1095623 0 0 1 745.40234 848.82227 z " + transform="matrix(0.26458333,0,0,0.26458333,-162.74701,-208.59428)" /> + + + + . . . + + + - + id="path1829-0" + d="m -156.88427,-143.76017 c 6.87806,-1.62635 8.41014,0.1657 7.3074,5.84606" + style="display:inline;fill:none;stroke:#b85050;stroke-width:1.5875;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - + cy="-146.09923" + cx="-148.15652" + id="path1802-1-5" + style="display:inline;opacity:1;vector-effect:none;fill:#a1dde9;fill-opacity:1;stroke:#000000;stroke-width:0.431694;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke" /> + id="path1970-3" + d="m -156.90089,-143.81216 8.82867,-2.30922" + style="display:inline;fill:none;stroke:#a1dde9;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - + style="fill:#f7f4ef;fill-opacity:1;stroke-width:0.028565" + d="m -150.23117,-167.96633 -1.67073,-0.9646 c -1.36591,2.36582 -1.82178,2.48208 -2.36015,2.7154 -0.53826,0.23319 -0.28672,0.75549 -0.28672,0.75549 0.40332,0.75097 -0.1374,2.10759 -0.23132,2.45702 -0.13163,0.0151 -0.31711,0.1056 -0.38843,0.22906 -0.10592,0.18354 0.0911,0.53279 0.24629,0.66565 l 0.31286,-0.54624 0.0731,-0.12767 1.217,-2.12278 c 0,0 -0.11983,-0.36228 -0.019,-0.56984 0.10085,-0.20756 0.34521,-0.45976 0.7042,-0.2525 0.35898,0.20725 0.26201,0.54539 0.13248,0.73553 -0.12957,0.19015 -0.50715,0.26588 -0.50715,0.26588 l -1.21667,2.12224 -0.0737,0.12848 -0.3131,0.54666 c 0.19364,0.0704 0.61532,0.13597 0.7219,-0.0486 0.076,-0.13161 0.0578,-0.3486 -0.007,-0.47465 0.74713,-0.77082 1.48218,-1.32357 2.00336,-1.4448 0.53531,-0.12457 0.48241,-0.52483 0.48241,-0.52483 -0.0478,-1.54875 1.17945,-3.54487 1.17945,-3.54487 z" + id="path2-9" + sodipodi:nodetypes="cccccscccczzzccccscccc" /> - - - - - - - - - - - Strokes - Stroke 1 - Stroke 2 - Stroke 3 - - - - - - - File - Edit - View - - Brushes - View - - - - Transform - Stroke 4 - - Stroke 5 - - Help - - - x: 212.12 pxy: 120.23 px - - - x: 10.05 pxy: 340.23 px - - - x: 410.12 pxy: 20.00 px - 300% - - Transform settings ... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . . . - - - + style="fill:#f5881b;fill-opacity:1;stroke-width:0.028565" + d="m -150.45578,-171.74118 -0.83063,1.4387 -0.19887,-0.11482 c -0.18889,-0.10901 -0.48118,0.0435 -0.59021,0.23247 -0.10902,0.18891 0.007,0.34258 0.19534,0.45162 l 2.35317,1.35861 c 0.18891,0.10902 0.3797,0.13222 0.48878,-0.0567 0.10901,-0.18889 0.0951,-0.5183 -0.0938,-0.62738 l -0.29575,-0.17074 0.83063,-1.4387 z" + id="path4" + sodipodi:nodetypes="ccssssssccc" /> diff --git a/src/app/MetaBrush/Asset/Brush.hs b/src/app/MetaBrush/Asset/Brush.hs deleted file mode 100644 index eb8fee4..0000000 --- a/src/app/MetaBrush/Asset/Brush.hs +++ /dev/null @@ -1,62 +0,0 @@ -module MetaBrush.Asset.Brush - ( drawBrush ) - 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 ) - --------------------------------------------------------------------------------- - --- | Calligraphy brush icon. Width = 29, height = 29. -drawBrush :: GDK.RGBA -> GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool -drawBrush brushColour bodyColour loopColour = do - - -- Loop - Cairo.setLineWidth 1 - withRGBA loopColour Cairo.setSourceRGBA - Cairo.newPath - Cairo.moveTo 23.144531 6.199219 - Cairo.curveTo 22.40625 6.890625 21.382813 5.953125 20.375 7.300781 - Cairo.curveTo 21.109375 5.925781 19.828125 5.410156 20.398438 4.324219 - Cairo.curveTo 20.894531 3.375 21.757813 2.621094 23.046875 3.636719 - Cairo.curveTo 24.035156 4.414063 24.128906 5.273438 23.144531 6.199219 - Cairo.closePath - Cairo.strokePreserve - - -- Brush body - withRGBA bodyColour Cairo.setSourceRGBA - Cairo.newPath - Cairo.moveTo 20.605469 7.359375 - Cairo.curveTo 20.988281 7.566406 21.476563 8.136719 21.195313 8.464844 - Cairo.lineTo 15.539063 14.84375 - Cairo.lineTo 14.90625 18.964844 - Cairo.curveTo 14.074219 19.195313 11.992188 17.941406 11.246094 17.457031 - Cairo.curveTo 10.5 16.976563 9.460938 15.597656 9.816406 15.351563 - Cairo.lineTo 13.507813 13.835938 - Cairo.lineTo 18.980469 6.996094 - Cairo.curveTo 19.25 6.660156 19.671875 6.613281 20 6.894531 - Cairo.closePath - Cairo.fillPreserve - - -- Brush tip - withRGBA brushColour Cairo.setSourceRGBA - Cairo.newPath - Cairo.moveTo 10.339844 19.335938 - Cairo.curveTo 11.089844 19.847656 11.996094 20.34375 12.683594 20.507813 - Cairo.curveTo 12.683594 20.507813 7.59375 24.476563 7.59375 24.476563 - Cairo.curveTo 6.867188 25.160156 4.785156 26.105469 4.601563 25.941406 - Cairo.curveTo 4.4375 25.792969 5.042969 24.261719 5.652344 23.140625 - Cairo.curveTo 5.652344 23.140625 8.566406 17.773438 8.566406 17.773438 - Cairo.curveTo 8.804688 18.136719 9.585938 18.820313 10.339844 19.335938 - Cairo.curveTo 10.339844 19.335938 10.339844 19.335938 10.339844 19.335938 - Cairo.closePath - Cairo.fillPreserve - - pure True diff --git a/src/app/MetaBrush/Asset/Colours.hs b/src/app/MetaBrush/Asset/Colours.hs index 69d5064..d0e5da5 100644 --- a/src/app/MetaBrush/Asset/Colours.hs +++ b/src/app/MetaBrush/Asset/Colours.hs @@ -10,7 +10,7 @@ module MetaBrush.Asset.Colours ( ColourRecord(..), ColourType - , colours + , Colours, getColours ) where @@ -32,27 +32,31 @@ import Data.Text data ColourRecord a = Colours - { bg :: !a - , viewport_bg :: !a - , plain :: !a - , contrast :: !a - , highlight :: !a - , logo_base :: !a - , logo_highlight :: !a - , viewport_scrollbar :: !a - , tab_scrollbar :: !a - , ruler :: !a - , magnifier :: !a - , glass :: !a - , cursor :: !a - , point :: !a - , control :: !a - } + { bg :: !a + , active :: !a + , highlight :: !a + , cursor :: !a + , cursorOutline :: !a + , plain :: !a + , base :: !a + , splash :: !a + , pathPoint :: !a + , pathPointOutline :: !a + , controlPoint :: !a + , controlPointOutline :: !a + , path :: !a + , brushStroke :: !a + , viewport :: !a + , viewportScrollbar :: !a + , tabScrollbar :: !a + , magnifier :: !a + , glass :: !a + } deriving stock ( Show, Functor, Foldable, Traversable ) data ColourType - = Color - | BackgroundColor + = Colour + | BackgroundColour deriving stock Show data ColourName @@ -65,31 +69,35 @@ data ColourName colourNames :: ColourRecord ColourName colourNames = Colours - { bg = ColourName "bg" BackgroundColor [ GTK.StateFlagsNormal ] - , viewport_bg = ColourName "viewport_bg" BackgroundColor [ GTK.StateFlagsNormal ] - , plain = ColourName "plain" Color [ GTK.StateFlagsNormal ] - , contrast = ColourName "contrast" Color [ GTK.StateFlagsNormal ] - , highlight = ColourName "highlight" Color [ GTK.StateFlagsNormal ] - , logo_base = ColourName "logo_base" Color [ GTK.StateFlagsNormal ] - , logo_highlight = ColourName "logo_highlight" Color [ GTK.StateFlagsNormal ] - , viewport_scrollbar = ColourName "viewport_scrollbar" Color [ GTK.StateFlagsNormal ] - , tab_scrollbar = ColourName "tab_scrollbar" Color [ GTK.StateFlagsNormal ] - , ruler = ColourName "ruler" BackgroundColor [ GTK.StateFlagsNormal ] - , magnifier = ColourName "magnifier" Color [ GTK.StateFlagsNormal ] - , glass = ColourName "glass" Color [ GTK.StateFlagsNormal ] - , cursor = ColourName "cursor" Color [ GTK.StateFlagsNormal ] - , point = ColourName "point" Color [ GTK.StateFlagsNormal ] - , control = ColourName "control" Color [ GTK.StateFlagsNormal ] - } + { bg = ColourName "bg" BackgroundColour [ GTK.StateFlagsNormal ] + , active = ColourName "active" BackgroundColour [ GTK.StateFlagsNormal ] + , highlight = ColourName "highlight" Colour [ GTK.StateFlagsNormal ] + , cursor = ColourName "cursor" Colour [ GTK.StateFlagsNormal ] + , cursorOutline = ColourName "cursorStroke" Colour [ GTK.StateFlagsNormal ] + , plain = ColourName "plain" Colour [ GTK.StateFlagsNormal ] + , base = ColourName "base" Colour [ GTK.StateFlagsNormal ] + , splash = ColourName "splash" Colour [ GTK.StateFlagsNormal ] + , pathPoint = ColourName "pathPoint" Colour [ GTK.StateFlagsNormal ] + , pathPointOutline = ColourName "pathPointStroke" Colour [ GTK.StateFlagsNormal ] + , controlPoint = ColourName "controlPoint" Colour [ GTK.StateFlagsNormal ] + , controlPointOutline = ColourName "controlPointStroke" Colour [ GTK.StateFlagsNormal ] + , path = ColourName "path" Colour [ GTK.StateFlagsNormal ] + , brushStroke = ColourName "brushStroke" Colour [ GTK.StateFlagsNormal ] + , viewport = ColourName "viewport" Colour [ GTK.StateFlagsNormal ] + , viewportScrollbar = ColourName "viewportScrollbar" BackgroundColour [ GTK.StateFlagsNormal ] + , tabScrollbar = ColourName "tabScrollbar" BackgroundColour [ GTK.StateFlagsNormal ] + , magnifier = ColourName "magnifier" Colour [ GTK.StateFlagsNormal ] + , glass = ColourName "glass" Colour [ GTK.StateFlagsNormal ] + } type Colours = ColourRecord GDK.RGBA -colours :: GTK.WidgetPath -> IO Colours -colours windowWidgetPath = +getColours :: GTK.WidgetPath -> IO Colours +getColours windowWidgetPath = for colourNames \ ( ColourName { .. } ) -> do style <- GTK.styleContextNew GTK.styleContextSetPath style windowWidgetPath GTK.styleContextAddClass style colourName case colourType of - BackgroundColor -> GTK.styleContextGetBackgroundColor style stateFlags - Color -> GTK.styleContextGetColor style stateFlags + BackgroundColour -> GTK.styleContextGetBackgroundColor style stateFlags + Colour -> GTK.styleContextGetColor style stateFlags diff --git a/src/app/MetaBrush/Asset/Cursor.hs b/src/app/MetaBrush/Asset/Cursor.hs index 00e6064..65b90a2 100644 --- a/src/app/MetaBrush/Asset/Cursor.hs +++ b/src/app/MetaBrush/Asset/Cursor.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE NamedFieldPuns #-} + module MetaBrush.Asset.Cursor ( drawCursor, drawCursorIcon ) where @@ -5,21 +7,20 @@ module MetaBrush.Asset.Cursor -- gi-cairo-render import qualified GI.Cairo.Render as Cairo --- gi-gdk -import qualified GI.Gdk as GDK - -- MetaBrush +import MetaBrush.Asset.Colours + ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | "Selection" mouse cursor. 18 x 18. -drawCursor :: GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool -drawCursor cursorColour outlineColour = do +drawCursor :: Colours -> Cairo.Render Bool +drawCursor ( Colours { cursor, cursorOutline } ) = do Cairo.setLineWidth 1 - withRGBA outlineColour Cairo.setSourceRGBA + 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 @@ -27,20 +28,20 @@ drawCursor cursorColour outlineColour = do Cairo.closePath Cairo.strokePreserve - withRGBA cursorColour Cairo.setSourceRGBA + withRGBA cursor Cairo.setSourceRGBA Cairo.fillPreserve pure True --- | "Selection" tool icon. 30 x 30. -drawCursorIcon :: GDK.RGBA -> Cairo.Render Bool -drawCursorIcon cursorColour = do +-- | "Selection" tool icon. 40 x 40. +drawCursorIcon :: Colours -> Cairo.Render Bool +drawCursorIcon ( Colours { cursor } ) = do - withRGBA cursorColour Cairo.setSourceRGBA + withRGBA cursor 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.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 diff --git a/src/app/MetaBrush/Asset/Logo.hs b/src/app/MetaBrush/Asset/Logo.hs index 1881ad9..ab0ca98 100644 --- a/src/app/MetaBrush/Asset/Logo.hs +++ b/src/app/MetaBrush/Asset/Logo.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE NamedFieldPuns #-} + module MetaBrush.Asset.Logo ( drawLogo ) where @@ -5,22 +7,21 @@ module MetaBrush.Asset.Logo -- gi-cairo-render import qualified GI.Cairo.Render as Cairo --- gi-gdk -import qualified GI.Gdk as GDK - -- MetaBrush +import MetaBrush.Asset.Colours + ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | MetaBrush logo. Width = 29, height = 29. -drawLogo :: GDK.RGBA -> GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool -drawLogo brushColour bodyColour loopColour = do +drawLogo :: Colours -> Cairo.Render Bool +drawLogo ( Colours { base, splash } ) = do -- Loop Cairo.setLineWidth 1 - withRGBA loopColour Cairo.setSourceRGBA + withRGBA base Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 17.480469 7.847656 Cairo.curveTo 16.890625 8.402344 16.070313 7.648438 15.257813 8.730469 @@ -32,7 +33,7 @@ drawLogo brushColour bodyColour loopColour = do Cairo.strokePreserve -- Body - withRGBA bodyColour Cairo.setSourceRGBA + withRGBA splash Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 14.53125 8.257813 Cairo.curveTo 14.386719 8.273438 14.246094 8.351563 14.140625 8.484375 @@ -67,7 +68,7 @@ drawLogo brushColour bodyColour loopColour = do Cairo.fillPreserve -- Brush tip - withRGBA brushColour Cairo.setSourceRGBA + withRGBA base Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 7.199219 18.394531 Cairo.curveTo 7.804688 18.804688 8.53125 19.203125 9.082031 19.335938 diff --git a/src/app/MetaBrush/Asset/Magnifier.hs b/src/app/MetaBrush/Asset/Magnifier.hs index 084f03f..8873947 100644 --- a/src/app/MetaBrush/Asset/Magnifier.hs +++ b/src/app/MetaBrush/Asset/Magnifier.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NegativeLiterals #-} module MetaBrush.Asset.Magnifier @@ -7,21 +8,20 @@ module MetaBrush.Asset.Magnifier -- gi-cairo-render import qualified GI.Cairo.Render as Cairo --- gi-gdk -import qualified GI.Gdk as GDK - -- MetaBrush +import MetaBrush.Asset.Colours + ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | Magnifying glass icon. Width = 19, height = 25. -drawMagnifier :: GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool -drawMagnifier magnifierColour glassColour = do +drawMagnifier :: Colours -> Cairo.Render Bool +drawMagnifier ( Colours { magnifier, glass } ) = do -- Magnifying glass. - withRGBA glassColour Cairo.setSourceRGBA + withRGBA glass Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 18.191406 6.144531 Cairo.curveTo 19.238281 10.191406 16.804688 14.324219 12.753906 15.371094 @@ -32,7 +32,7 @@ drawMagnifier magnifierColour glassColour = do Cairo.fillPreserve -- Magnifier. - withRGBA magnifierColour Cairo.setSourceRGBA + withRGBA magnifier Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 11.144531 0.00390625 Cairo.curveTo 8.296875 -0.09375 5.484375 1.332031 3.933594 3.960938 diff --git a/src/app/MetaBrush/Asset/Meta.hs b/src/app/MetaBrush/Asset/Meta.hs deleted file mode 100644 index fa2b272..0000000 --- a/src/app/MetaBrush/Asset/Meta.hs +++ /dev/null @@ -1,44 +0,0 @@ -module MetaBrush.Asset.Meta - ( drawMeta ) - 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 ) - --------------------------------------------------------------------------------- - --- | MetaParameter icon. Width = 29, height = 29. -drawMeta :: GDK.RGBA -> Cairo.Render Bool -drawMeta metaColour = do - withRGBA metaColour Cairo.setSourceRGBA - Cairo.newPath - Cairo.moveTo 16.140625 11.976563 - Cairo.curveTo 15.042969 10.355469 13.957031 7.050781 13.257813 7.195313 - Cairo.curveTo 12.878906 7.078125 5.332031 18.234375 4.664063 19.019531 - Cairo.curveTo 3.90625 18.234375 2.886719 19.078125 2.800781 20.273438 - Cairo.curveTo 2.800781 20.886719 4.28125 22.585938 5.566406 20.738281 - Cairo.curveTo 5.6875 20.566406 11.421875 12.542969 11.957031 11.753906 - Cairo.curveTo 12.421875 12.714844 14.351563 16.082031 14.46875 16.230469 - Cairo.curveTo 15.605469 15.660156 15.863281 15.316406 16.476563 14.589844 - Cairo.curveTo 17.171875 13.621094 17.265625 13.5 18.207031 12.261719 - Cairo.curveTo 18.644531 13.164063 20 14.65625 21.238281 16.253906 - Cairo.curveTo 21.703125 16.855469 23.695313 18.898438 24.28125 18.671875 - Cairo.curveTo 24.589844 18.550781 25.699219 17.550781 25.894531 16.492188 - Cairo.curveTo 25.941406 16.253906 26.050781 15.351563 25.847656 15.167969 - Cairo.curveTo 25.707031 15.039063 24.519531 15.707031 24.148438 15.5625 - Cairo.curveTo 23.507813 14.621094 22.722656 12.988281 22.042969 11.859375 - Cairo.curveTo 20.964844 9.90625 20.125 7.507813 19.257813 8.039063 - Cairo.curveTo 18.652344 8.410156 18.308594 8.867188 18.179688 9.058594 - Cairo.curveTo 17.574219 9.9375 17.289063 10.367188 16.140625 11.976563 - Cairo.curveTo 16.140625 11.976563 16.140625 11.976563 16.140625 11.976563 - Cairo.closePath - Cairo.fillPreserve - - pure True diff --git a/src/app/MetaBrush/Asset/TickBox.hs b/src/app/MetaBrush/Asset/TickBox.hs index 7251d4f..42e4206 100644 --- a/src/app/MetaBrush/Asset/TickBox.hs +++ b/src/app/MetaBrush/Asset/TickBox.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NegativeLiterals #-} module MetaBrush.Asset.TickBox @@ -7,19 +8,18 @@ module MetaBrush.Asset.TickBox -- gi-cairo-render import qualified GI.Cairo.Render as Cairo --- gi-gdk -import qualified GI.Gdk as GDK - -- MetaBrush +import MetaBrush.Asset.Colours + ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | Non-ticked box. Width = 14, height = 12. -drawBox :: GDK.RGBA -> Cairo.Render Bool -drawBox boxColour = do - withRGBA boxColour Cairo.setSourceRGBA +drawBox :: Colours -> Cairo.Render Bool +drawBox ( Colours { plain } ) = do + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 2.015625 0.769531 @@ -49,11 +49,11 @@ drawBox boxColour = do -- | Ticked box. Width = 14, height = 12. -drawTickedBox :: GDK.RGBA -> GDK.RGBA -> Cairo.Render Bool -drawTickedBox boxColour tickColour = do +drawTickedBox :: Colours -> Cairo.Render Bool +drawTickedBox ( Colours { plain } ) = do -- Box - withRGBA boxColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 2.015625 0.769531 Cairo.curveTo 0.910156 0.769531 0 1.679688 0 2.785156 @@ -77,7 +77,7 @@ drawTickedBox boxColour tickColour = do Cairo.fillPreserve -- Tickmark - withRGBA tickColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 13.40625 0.0078125 Cairo.curveTo 13.191406 0.0390625 12.96875 0.144531 12.785156 0.328125 diff --git a/src/app/MetaBrush/Asset/Tools.hs b/src/app/MetaBrush/Asset/Tools.hs new file mode 100644 index 0000000..f26a064 --- /dev/null +++ b/src/app/MetaBrush/Asset/Tools.hs @@ -0,0 +1,224 @@ +{-# 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 \ No newline at end of file diff --git a/src/app/MetaBrush/Asset/WindowIcons.hs b/src/app/MetaBrush/Asset/WindowIcons.hs index da9bd2b..e6c2c2b 100644 --- a/src/app/MetaBrush/Asset/WindowIcons.hs +++ b/src/app/MetaBrush/Asset/WindowIcons.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE NamedFieldPuns #-} + module MetaBrush.Asset.WindowIcons ( drawMinimise, drawRestoreDown, drawMaximise, drawClose ) where @@ -5,20 +7,19 @@ module MetaBrush.Asset.WindowIcons -- gi-cairo-render import qualified GI.Cairo.Render as Cairo --- gi-gdk -import qualified GI.Gdk as GDK - -- MetaBrush +import MetaBrush.Asset.Colours + ( ColourRecord(..), Colours ) import MetaBrush.Render.Util ( withRGBA ) -------------------------------------------------------------------------------- -- | Minimise window icon. -drawMinimise :: GDK.RGBA -> Cairo.Render Bool -drawMinimise iconColour = do +drawMinimise :: Colours -> Cairo.Render Bool +drawMinimise ( Colours { plain } ) = do - withRGBA iconColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 6.144531 12.914063 @@ -31,10 +32,10 @@ drawMinimise iconColour = do pure True -- | Restore down window icon. -drawRestoreDown :: GDK.RGBA -> Cairo.Render Bool -drawRestoreDown iconColour = do +drawRestoreDown :: Colours -> Cairo.Render Bool +drawRestoreDown ( Colours { plain } ) = do - withRGBA iconColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 8.453125 4.179688 @@ -63,10 +64,10 @@ drawRestoreDown iconColour = do pure True -- | Maximise window icon. -drawMaximise :: GDK.RGBA -> Cairo.Render Bool -drawMaximise iconColour = do +drawMaximise :: Colours -> Cairo.Render Bool +drawMaximise ( Colours { plain } ) = do - withRGBA iconColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.newPath Cairo.moveTo 5.386719 5.449219 @@ -84,11 +85,11 @@ drawMaximise iconColour = do pure True -- | Close window icon. -drawClose :: GDK.RGBA -> Cairo.Render Bool -drawClose iconColour = do +drawClose :: Colours -> Cairo.Render Bool +drawClose ( Colours { plain } ) = do Cairo.setLineWidth 2 - withRGBA iconColour Cairo.setSourceRGBA + withRGBA plain Cairo.setSourceRGBA Cairo.setLineCap Cairo.LineCapRound Cairo.setLineJoin Cairo.LineJoinMiter