adding process function

This commit is contained in:
nek0 2017-03-16 20:52:45 +01:00
parent cb16e5ef09
commit a32c8957bd
4 changed files with 9 additions and 5 deletions

View file

@ -90,7 +90,7 @@ draw = do
traceM "drawing" traceM "drawing"
UserData{..} <- getAffection UserData{..} <- getAffection
drawRect (nodeGraph M.! "nop") (G.RGB 1 0 0) Fill (G.GeglRectangle 10 10 500 500) foreground 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 :: Affection UserData ()
update = do update = do

View file

@ -85,9 +85,7 @@ load _ = do
draw :: Affection UserData () draw :: Affection UserData ()
draw = do draw = do
traceM "drawing"
UserData{..} <- getAffection UserData{..} <- getAffection
clear foreground
maybe (return ()) (\(x, y) -> maybe (return ()) (\(x, y) ->
drawRect drawRect
(nodeGraph M.! "nop") (nodeGraph M.! "nop")
@ -96,7 +94,7 @@ draw = do
(G.GeglRectangle (x - 10) (y - 10) 20 20) (G.GeglRectangle (x - 10) (y - 10) 20 20)
foreground foreground
) coordinates ) coordinates
liftIO $ G.gegl_node_process $ nodeGraph M.! "sink" process (nodeGraph M.! "sink")
update :: Affection UserData () update :: Affection UserData ()
update = do update = do

View file

@ -89,7 +89,7 @@ draw :: Affection UserData ()
draw = do draw = do
traceM "drawing" traceM "drawing"
UserData{..} <- getAffection UserData{..} <- getAffection
liftIO $ G.gegl_node_process $ nodeGraph M.! "sink" process $ nodeGraph M.! "sink"
-- ad <- get -- ad <- get
-- ud <- getAffection -- ud <- getAffection
-- drawParticles partDraw $ particles ud -- drawParticles partDraw $ particles ud

View file

@ -7,6 +7,7 @@ module Affection.Draw
, handleDrawRequest , handleDrawRequest
, invalidateDrawRequest , invalidateDrawRequest
, present , present
, process
, clearArea , clearArea
) where ) where
@ -66,6 +67,11 @@ present rect buf kill = do
{ drawStack = (DrawRequest rect buf k) : drawStack ad { 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 -- | function for handling 'DrawRequest's and updating the output
handleDrawRequest handleDrawRequest
:: Ptr a -- ^ Pixel buffer to blit to :: Ptr a -- ^ Pixel buffer to blit to