[gegl] rgegl - updated an example



commit 64e04d2f55b7d0daa8ce813a21f423d1f753ec9e
Author: �yvind Kolås <pippin gimp org>
Date:   Sat Dec 5 17:31:56 2009 +0000

    rgegl - updated an example
    
    xmlparsing.rb was still referring to gegl:shift which is deprecated in
    favor of gegl:translate with fast paths for integers.

 bindings/rgegl/samples/xml-parsing.rb |   46 +++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 8 deletions(-)
---
diff --git a/bindings/rgegl/samples/xml-parsing.rb b/bindings/rgegl/samples/xml-parsing.rb
index 07ce44e..b7328d2 100755
--- a/bindings/rgegl/samples/xml-parsing.rb
+++ b/bindings/rgegl/samples/xml-parsing.rb
@@ -9,20 +9,50 @@ require 'gegl'
 gegl=Gegl.parse_xml(
 "<gegl>
    <gegl:display name='display'/>
-   <gegl:crop x='0' y='145' width='320' height='240'/>
+   <gegl:crop x='0' y='0' width='640' height='300'/>
    <gegl:over>
+     <gegl:translate x='20.0' y='120.0' name='shift'/>
+     <gegl:opacity value='0.4' name='opacity' />
      <gegl:gaussian-blur std_dev_y='0' name='blur'/>
-     <gegl:shift x='20' y='170' name='shift'/>
-     <gegl:text string='rgegl' size='120' color='rgb(0.5,0.5,1.0)'/>
+     <gegl:text string='GEGL' name='text' size='60' color='rgb(0.0,0.0,0.0)'/>
    </gegl:over>
+   <gegl:invert/>
+   <gegl:brightness-contrast contrast='0.4' brightness='-0.3'/>
+   <gegl:gaussian-blur />
    <gegl:fractal-explorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45'
-                    width='320' height='400'/>
+     width='640' height='300'/>
 </gegl>", "")
 
-frames=50
+"GEGL
+image processing
+compositing graph
+linear RGB
+32bit float RGB
+128bit/pixel
+caching
+".split("\n").each {|title|
+
+  gegl.lookup("text").string = title
+  gegl.lookup('shift').x = 640/2- gegl.lookup('text').bounding_box.width/2;
+
+# should use a realtime frame rate for this demo instead.
+frames=20
+frames.times do |frame|
+  t = 1.0*frame/(frames-1)
+  #gegl.lookup("shift").y       =  t * 200 - 40
+  gegl.lookup("opacity").value  =  t
+  gegl.lookup("blur").std_dev_x = (1.0-t) * 100.0
+  gegl.lookup("blur").std_dev_y = (1.0-t) * 0.0
+  gegl.lookup("display").process
+end
+
+sleep 2
+
 frames.times do |frame|
-  t = 1.0*frame/frames
-  gegl.lookup("blur").std_dev_x = t * 20.0
-  gegl.lookup("shift").y       =  t * 200
+  t = 1.0*frame/(frames-1)
+  gegl.lookup("opacity").value  =  1.0-t
+  gegl.lookup("blur").std_dev_x = (t) * 100.0
+  gegl.lookup("blur").std_dev_y = (t) * 0.0
   gegl.lookup("display").process
 end
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]