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