[opengtl-commits] [681] add a mosaic effect

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


Revision: 681
Author:   cyrille
Date:     2009-03-25 13:29:38 +0100 (Wed, 25 Mar 2009)

Log Message:
-----------
add a mosaic effect

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


Added: trunk/shiva-collections/filters/Mosaic.shiva
===================================================================
--- trunk/shiva-collections/filters/Mosaic.shiva	                        (rev 0)
+++ trunk/shiva-collections/filters/Mosaic.shiva	2009-03-25 12:29:38 UTC (rev 681)
@@ -0,0 +1,29 @@
+<
+  parameters: <
+    cellsize: <
+      label: "Size";
+      type: float;
+      minValue: 0.0001;
+      maxValue: 100.0;
+      defaultValue: 0.05;
+    >;
+  >;
+>;  
+kernel Mosaic
+{  
+  const float2 imsize = { 1000.0, 800.0 };
+  float2 fmod2( float2 f, float v )
+  {
+    return float2( fmod(f.x,v), fmod(f.y,v) );
+  }
+  void evaluatePixel(image img, out pixel result)
+  {
+    float2 vec = result.coord - fmod2( result.coord + imsize, cellsize );
+    result = img.sampleNearest( vec );
+    result[3] = 1.0;
+  }
+  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/