[opengtl-commits] [630] add a slice filter

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 630
Author:   cyrille
Date:     2009-03-16 11:23:48 +0100 (Mon, 16 Mar 2009)

Log Message:
-----------
add a slice filter

Added Paths:
-----------
    trunk/shiva-collections/filters/Slices.shiva


Added: trunk/shiva-collections/filters/Slices.shiva
===================================================================
--- trunk/shiva-collections/filters/Slices.shiva	                        (rev 0)
+++ trunk/shiva-collections/filters/Slices.shiva	2009-03-16 10:23:48 UTC (rev 630)
@@ -0,0 +1,34 @@
+<
+  parameters: <
+    sliceWidth: <
+      label: "Slice width";
+      type: int;
+      minValue: 1;
+      defaultValue: 10;
+      maxValue: 100;
+    >;
+    sliceHeight: <
+      label: "Slice height";
+      type: int;
+      minValue: 1;
+      defaultValue: 10;
+      maxValue: 100;
+    >;
+  >;
+>;  
+kernel Ripples
+{  
+  void evaluatePixel(image4 img, out pixel4 result)
+  {
+    float x = result.coord.x;
+    float y = result.coord.y;
+    float2 displacement;
+    displacement[0] = 5 * sign( cos( y / sliceWidth ) );
+    displacement[1] = 5 * sign( sin( x / sliceHeight ) );
+    result = img.sampleNearest( result.coord + displacement );
+  }
+  region changed(region changed_input_region, int input_index, region input_DOD[])
+  {
+    return changed_input_region;
+  }
+}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/