From a32c8957bd8ea967d29e5262f44126e482ae5006 Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 16 Mar 2017 20:52:45 +0100 Subject: [PATCH] adding process function --- examples/example01.hs | 2 +- examples/example02.hs | 4 +--- examples/example03.hs | 2 +- src/Affection/Draw.hs | 6 ++++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/example01.hs b/examples/example01.hs index 398018a..0acefcc 100644 --- a/examples/example01.hs +++ b/examples/example01.hs @@ -90,7 +90,7 @@ draw = do traceM "drawing" UserData{..} <- getAffection drawRect (nodeGraph M.! "nop") (G.RGB 1 0 0) Fill (G.GeglRectangle 10 10 500 500) foreground - liftIO $ G.gegl_node_process $ nodeGraph M.! "sink" + process $ nodeGraph M.! "sink" update :: Affection UserData () update = do diff --git a/examples/example02.hs b/examples/example02.hs index ffa6bde..c41f862 100644 --- a/examples/example02.hs +++ b/examples/example02.hs @@ -85,9 +85,7 @@ load _ = do draw :: Affection UserData () draw = do - traceM "drawing" UserData{..} <- getAffection - clear foreground maybe (return ()) (\(x, y) -> drawRect (nodeGraph M.! "nop") @@ -96,7 +94,7 @@ draw = do (G.GeglRectangle (x - 10) (y - 10) 20 20) foreground ) coordinates - liftIO $ G.gegl_node_process $ nodeGraph M.! "sink" + process (nodeGraph M.! "sink") update :: Affection UserData () update = do diff --git a/examples/example03.hs b/examples/example03.hs index ffa4ac4..9367bfb 100644 --- a/examples/example03.hs +++ b/examples/example03.hs @@ -89,7 +89,7 @@ draw :: Affection UserData () draw = do traceM "drawing" UserData{..} <- getAffection - liftIO $ G.gegl_node_process $ nodeGraph M.! "sink" + process $ nodeGraph M.! "sink" -- ad <- get -- ud <- getAffection -- drawParticles partDraw $ particles ud diff --git a/src/Affection/Draw.hs b/src/Affection/Draw.hs index 6c6ffea..b016761 100644 --- a/src/Affection/Draw.hs +++ b/src/Affection/Draw.hs @@ -7,6 +7,7 @@ module Affection.Draw , handleDrawRequest , invalidateDrawRequest , present + , process , clearArea ) where @@ -66,6 +67,11 @@ present rect buf kill = do { drawStack = (DrawRequest rect buf k) : drawStack ad } +process + :: G.GeglNode + -> Affection us () +process = liftIO . G.gegl_node_process + -- | function for handling 'DrawRequest's and updating the output handleDrawRequest :: Ptr a -- ^ Pixel buffer to blit to