pippin.gimp.org/gggl/api/ruby/samples/sample1.rb
#!/usr/bin/env ruby

require 'gggl'

# create a new gggl graph
graph = Gggl::Graph.new

# create the processing op's (nodes) that
# are to be in our graph
display = graph.op_new 'display',
                       'title' => "gggl from ruby"

noise   = graph.op_new 'noise',
                       'scale' => 5,
                       'n'     => 3,
                       'zoff'  => 2

blank   = graph.op_new 'blank',
                       'width'  => 400,
                       'height' => 300

# assign inputs / outputs

noise.input_pad[0]   = blank
display.input_pad[0] = noise


50.times do
    |i|
    noise['zoff'] = noise['zoff'].to_f + 0.01
    display.process
end

over = graph.op_new 'over',
       'x' => 0.1,
       'y' => 0.9 
text = graph.op_new 'text',
       'string' => 'gggl from ruby!',
       'size' => 30,
       'font' => 'Sans'

# adding a porter duff over operator to the graph
       
over.input_pad[0]    = display.input_pad[0]
display.input_pad[0] = over


text.destroy

graph.each do 
    |node|
    puts "#{node.type}"
    node.each_pair do
        |key,value|
        puts "\t#{key} = #{value}"
    end
end


over.input_pad[1]    = text

600.times do
    |i|
    #    noise['zoff'] = noise['zoff'].to_f + 0.01
    over['y']= over['y'].to_f-0.001
    display.process
end


Generated by GNU enscript 1.6.4.
xhml·css last html rebuild: Wed Mar 30 23:08:22 CEST 2005   pippin@gimp·org