packages feed

gegl-0.0.0.1: examples/example00.hs

-- This is a simple hello world propgram, which renders "hello world" as text

import GEGL
import qualified System.Environment as E

main :: IO ()
main = do
  args <- E.getArgs
  str <- if null args
    then
      return "woo!"
    else
      return $ unwords args
  gegl_init
  putStrLn str
  gegl <- gegl_node_new
  putStrLn "new root node"
  display <- gegl_node_new_child gegl (pngSaveOperation
    [Property "path" (PropertyString "examples/example00.png")])
  putStrLn "first child"
  over <- gegl_node_new_child gegl defaultOverOperation
  putStrLn "over node"
  text <- gegl_node_new_child gegl (textOperation
    [ Property "string" $ PropertyString str
    , Property "color" $ PropertyColor $ RGB 1 0 0
    , Property "size"   $ PropertyDouble 40
    ])
  putStrLn "text node"
  gegl_node_link_many [over, display]
  putStrLn "link over and display"
  gegl_node_connect_to text "output" over "aux"
  putStrLn "connect text to over"
  gegl_node_process display
  putStrLn "process display"
  gegl_exit
  putStrLn "good night"