gegl r1909 - in trunk: . operations/generated



Author: kcozens
Date: Thu Jan 24 21:10:12 2008
New Revision: 1909
URL: http://svn.gnome.org/viewvc/gegl?rev=1909&view=rev

Log:
	* operations/generated/math.rb:
	* operations/generated/other-blend.rb:
	* operations/generated/svg-12-blend.rb:
	* operations/generated/svg-12-porter-duff.rb: Updated to generate
	files which use the new chanting API.


Modified:
   trunk/ChangeLog
   trunk/operations/generated/math.rb
   trunk/operations/generated/other-blend.rb
   trunk/operations/generated/svg-12-blend.rb
   trunk/operations/generated/svg-12-porter-duff.rb

Modified: trunk/operations/generated/math.rb
==============================================================================
--- trunk/operations/generated/math.rb	(original)
+++ trunk/operations/generated/math.rb	Thu Jan 24 21:10:12 2008
@@ -3,10 +3,24 @@
 copyright = '
 /* !!!! AUTOGENERATED FILE generated by math.rb !!!!! 
  *
- *  Copyright 2006 Ãyvind KolÃs <pippin gimp org>
+ * This file is an image processing operation for GEGL
  *
- * !!!! AUTOGENERATED FILE !!!!!
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  *
+ * !!!! AUTOGENERATED FILE !!!!!
  */'
 
 a = [
@@ -35,25 +49,23 @@
 
     file.write copyright
     file.write "
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 gegl_chant_double (value, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, \"global value used if aux doesn't contain data\")
-#else
 
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_DESCRIPTION   \"Math operation #{name} (#{formula})\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:math\"
+#else
 
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE       \"#{filename}\"
 
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 
 #include <math.h>
 #ifdef _MSC_VER
 #define powf(a,b) ((gfloat)pow(a,b))
 #endif
 
+
 static void prepare (GeglOperation *operation)
 {
   Babl *format = babl_format (\"RGBA float\");
@@ -65,57 +77,75 @@
 
 static gboolean
 process (GeglOperation *op,
-          void          *in_buf,
-          void          *aux_buf,
-          void          *out_buf,
-          glong          n_pixels)
+          void         *in_buf,
+          void         *aux_buf,
+          void         *out_buf,
+          glong         n_pixels)
 {
-  gint i;
   gfloat *in = in_buf;
   gfloat *out = out_buf;
   gfloat *aux = aux_buf;
+gint    i;
 
   if (aux == NULL)
-      {
-          gfloat value = GEGL_CHANT_OPERATION (op)->value;
-          for (i=0; i<n_pixels; i++)
-            {
-              int  j;
-              gfloat c;
-              for (j=0; j<3; j++)
-                  {
-                      c=in[j];
-                      #{formula};
-                      out[j]=c;
-                  }
-              out[3]=in[3];
-              in += 4;
-              out+= 4;
-            }
-      }
+    {
+      gfloat value = GEGL_CHANT_PROPERTIES (op)->value;
+      for (i=0; i<n_pixels; i++)
+	{
+	  gint   j;
+	  gfloat c;
+	  for (j=0; j<3; j++)
+	    {
+	      c=in[j];
+	      #{formula};
+	      out[j]=c;
+	    }
+	  out[3]=in[3];
+	  in += 4;
+	  out+= 4;
+	}
+    }
   else
-      {
-          for (i=0; i<n_pixels; i++)
-            {
-              int  j;
-              gfloat c;
-              gfloat value;
-              for (j=0; j<3; j++)
-                  {
-                      c=in[j];
-                      value=aux[j];
-                      #{formula};
-                      out[j]=c;
-                  }
-              out[3]=in[3];
-              in += 4;
-              aux += 3;
-              out+= 4;
-            }
-      }
+    {
+      for (i=0; i<n_pixels; i++)
+	{
+	  gint   j;
+	  gfloat c;
+	  gfloat value;
+	  for (j=0; j<3; j++)
+	    {
+	      c=in[j];
+	      value=aux[j];
+	      #{formula};
+	      out[j]=c;
+	    }
+	  out[3]=in[3];
+	  in += 4;
+	  aux += 3;
+	  out+= 4;
+	}
+    }
   
   return TRUE;
 }
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass              *operation_class;
+  GeglOperationPointComposerClass *point_composer_class;
+
+  operation_class  = GEGL_OPERATION_CLASS (klass);
+  point_composer_class     = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
+
+  point_composer_class->process = process;
+  operation_class->prepare = prepare;
+
+  operation_class->name        = \"#{name}\";
+  operation_class->categories  = \"compositors:math\";
+  operation_class->description =
+       \"Math operation #{name} (#{formula})\";
+}
 #endif
 "
     file.close

Modified: trunk/operations/generated/other-blend.rb
==============================================================================
--- trunk/operations/generated/other-blend.rb	(original)
+++ trunk/operations/generated/other-blend.rb	Thu Jan 24 21:10:12 2008
@@ -29,7 +29,6 @@
  *     cA = aux(src) colour     cB = in(dst) colour     cD = out colour
  *
  * !!!! AUTOGENERATED FILE !!!!!
- *
  */'
 
 a = [
@@ -42,8 +41,10 @@
     ]
 
 file_head1 = '
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 /* no properties */
+
 #else
 '
 
@@ -64,10 +65,10 @@
           void          *out_buf,
           glong          n_pixels)
 {
-  gint i;
   gfloat *in = in_buf;
   gfloat *aux = aux_buf;
   gfloat *out = out_buf;
+  gint    i;
 
   if (aux==NULL)
     return TRUE;
@@ -77,12 +78,28 @@
   return TRUE;
 }
 
-static void class_init (GeglOperationClass *klass)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  klass->no_cache = TRUE;  /* the over op has special fast paths
-                              that makes caching be buggy in
-                              many circumstances.
-                            */
+  GeglOperationClass              *operation_class;
+  GeglOperationPointComposerClass *point_composer_class;
+
+  operation_class      = GEGL_OPERATION_CLASS (klass);
+  point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
+
+  point_composer_class->process = process;
+  operation_class->prepare = prepare;
+
+  operation_class->name        = "#{name}";
+  operation_class->categories  = "compositors:other_blend";
+  operation_class->description =
+        "Other blend operation #{name} (d = #{c_formula})";
+
+  operation_class->no_cache = TRUE;   /* the over op has special fast paths
+                                         that makes caching be buggy in
+                                         many circumstances.
+                                      */
 }
 
 #endif
@@ -108,16 +125,12 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:other blend\"
-#define GEGL_CHANT_DESCRIPTION   \"Other blend operation #{name} (d = #{c_formula})\"
-
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
-#define GEGL_CHANT_CLASS_INIT
 
-#include \"gegl-old-chant.h\"
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE        \"#{filename}\"
+
+#include \"gegl-chant.h\"
+
 "
     file.write file_head2
     file.write "
@@ -131,21 +144,19 @@
       aD = #{a_formula};
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+        {
+          gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              out[j] = #{c_formula};
-          }
+          cB = in[j];
+          cA = aux[j];
+          out[j] = #{c_formula};
+        }
       out[3] = aD;
       in  += 4;
       aux += 4;
       out += 4;
     }
 
-
-
 "
   file.write file_tail
   file.close

Modified: trunk/operations/generated/svg-12-blend.rb
==============================================================================
--- trunk/operations/generated/svg-12-blend.rb	(original)
+++ trunk/operations/generated/svg-12-blend.rb	Thu Jan 24 21:10:12 2008
@@ -29,7 +29,6 @@
  *     cA = aux(src) colour     cB = in(dst) colour     cD = out colour
  *
  * !!!! AUTOGENERATED FILE !!!!!
- *
  */'
 
 a = [
@@ -71,8 +70,10 @@
     ]
 
 file_head1 = '
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 /* no properties */
+
 #else
 '
 
@@ -88,24 +89,40 @@
 
 static gboolean
 process (GeglOperation *op,
-          void          *in_buf,
-          void          *aux_buf,
-          void          *out_buf,
-          glong          n_pixels)
+          void         *in_buf,
+          void         *aux_buf,
+          void         *out_buf,
+          glong         n_pixels)
 {
-  gint i;
   gfloat *in = in_buf;
   gfloat *aux = aux_buf;
   gfloat *out = out_buf;
+  gint    i;
 
   if (aux==NULL)
     return TRUE;
 '
 
-file_tail = '
+file_tail1 = '
   return TRUE;
 }
 
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass              *operation_class;
+  GeglOperationPointComposerClass *point_composer_class;
+
+  operation_class      = GEGL_OPERATION_CLASS (klass);
+  point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
+
+  point_composer_class->process = process;
+  operation_class->prepare = prepare;
+'
+
+file_tail2 = '  operation_class->categories  = "compositors:svgfilter";
+}
+
 #endif
 '
 
@@ -128,42 +145,43 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:svgfilter\"
-#define GEGL_CHANT_DESCRIPTION   \"SVG blend operation #{name} (<tt>d = #{formula1}</tt>)\"
-
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE        \"#{filename}\"
 
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 "
     file.write file_head2
     file.write "
   for (i = 0; i < n_pixels; i++)
     {
-      int  j;
       gfloat aA, aB, aD;
+      gint   j;
 
       aB = in[3];
       aA = aux[3];
       aD = aA + aB - aA * aB;
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+        {
+          gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              out[j] = CLAMP (#{formula1}, 0, aD);
-          }
+          cB = in[j];
+          cA = aux[j];
+          out[j] = CLAMP (#{formula1}, 0, aD);
+        }
       out[3] = aD;
       in  += 4;
       aux += 4;
       out += 4;
     }
 "
-  file.write file_tail
+  file.write file_tail1
+  file.write "
+  operation_class->name        = \"#{name}\";
+  operation_class->description =
+	\"SVG blend operation #{name} (<tt>d = #{formula1}</tt>)\";
+"
+  file.write file_tail2
   file.close
 end
 
@@ -188,45 +206,46 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:svgfilter\"
-#define GEGL_CHANT_DESCRIPTION   \"SVG blend operation #{name} (<tt>if #{cond1}: d = #{formula1} otherwise: d = #{formula2}</tt>)\"
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE       \"#{filename}\"
 
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
-
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 "
     file.write file_head2
     file.write "
   for (i = 0; i < n_pixels; i++)
     {
-      int  j;
       gfloat aA, aB, aD;
+      gint   j;
 
       aB = in[3];
       aA = aux[3];
       aD = aA + aB - aA * aB;
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+        {
+          gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              if (#{cond1})
-                out[j] = CLAMP (#{formula1}, 0, aD);
-              else
-                out[j] = CLAMP (#{formula2}, 0, aD);
-          }
+          cB = in[j];
+          cA = aux[j];
+          if (#{cond1})
+            out[j] = CLAMP (#{formula1}, 0, aD);
+          else
+            out[j] = CLAMP (#{formula2}, 0, aD);
+        }
       out[3] = aD;
       in  += 4;
       aux += 4;
       out += 4;
     }
 "
-  file.write file_tail
+  file.write file_tail1
+  file.write "
+  operation_class->name        = \"#{name}\";
+  operation_class->description =
+	\"SVG blend operation #{name} (<tt>if #{cond1}: d = #{formula1} otherwise: d = #{formula2}</tt>)\";
+"
+  file.write file_tail2
   file.close
 end
 
@@ -253,48 +272,49 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:svgfilter\"
-#define GEGL_CHANT_DESCRIPTION   \"SVG blend operation #{name} (<tt>if #{cond1}: d = #{formula1}; if #{cond2}: d = #{formula2}; otherwise: d = #{formula3}</tt>)\"
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE       \"#{filename}\"
 
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
-
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 #include <math.h>
 "
     file.write file_head2
     file.write "
   for (i = 0; i < n_pixels; i++)
     {
-      int  j;
       gfloat aA, aB, aD;
+      gint   j;
 
       aB = in[3];
       aA = aux[3];
       aD = aA + aB - aA * aB;
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+        {
+          gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              if (#{cond1})
-                out[j] = CLAMP (#{formula1}, 0, aD);
-              else if (#{cond2})
-                out[j] = CLAMP (#{formula2}, 0, aD);
-              else
-                out[j] = CLAMP (#{formula3}, 0, aD);
-          }
+          cB = in[j];
+          cA = aux[j];
+          if (#{cond1})
+            out[j] = CLAMP (#{formula1}, 0, aD);
+          else if (#{cond2})
+            out[j] = CLAMP (#{formula2}, 0, aD);
+          else
+            out[j] = CLAMP (#{formula3}, 0, aD);
+        }
       out[3] = aD;
       in  += 4;
       aux += 4;
       out += 4;
     }
 "
-  file.write file_tail
+  file.write file_tail1
+  file.write "
+  operation_class->name        = \"#{name}\";
+  operation_class->description =
+	\"SVG blend operation #{name} (<tt>if #{cond1}: d = #{formula1}; if #{cond2}: d = #{formula2}; otherwise: d = #{formula3}</tt>)\";
+"
+  file.write file_tail2
   file.close
 end
 
@@ -318,41 +338,42 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:svgfilter\"
-#define GEGL_CHANT_DESCRIPTION   \"SVG blend operation #{name} (<tt>d = #{formula1}</tt>)\"
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE       \"#{filename}\"
 
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
-
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 "
     file.write file_head2
     file.write "
   for (i = 0; i < n_pixels; i++)
     {
-      int  j;
       gfloat aA, aB, aD;
+      gint   j;
 
       aB = in[3];
       aA = aux[3];
       aD = #{formula2};
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+	{
+	  gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              out[j] = CLAMP (#{formula1}, 0, aD);
-          }
+	  cB = in[j];
+	  cA = aux[j];
+	  out[j] = CLAMP (#{formula1}, 0, aD);
+	}
       out[3] = aD;
       in  += 4;
       aux += 4;
       out += 4;
     }
 "
-  file.write file_tail
+  file.write file_tail1
+  file.write "
+  operation_class->name        = \"#{name}\";
+  operation_class->description =
+	\"SVG blend operation #{name} (<tt>d = #{formula1}</tt>)\";
+"
+  file.write file_tail2
   file.close
 end

Modified: trunk/operations/generated/svg-12-porter-duff.rb
==============================================================================
--- trunk/operations/generated/svg-12-porter-duff.rb	(original)
+++ trunk/operations/generated/svg-12-porter-duff.rb	Thu Jan 24 21:10:12 2008
@@ -29,7 +29,6 @@
  *     cA = aux(src) colour     cB = in(dst) colour     cD = out colour
  *
  * !!!! AUTOGENERATED FILE !!!!!
- *
  */'
 
 a = [
@@ -43,7 +42,7 @@
                         'aA + aB - aA * aB'],
       ['dst_over',      'cB + cA * (1 - aB)',
                         'aA + aB - aA * aB'],
-      ['src_in',        'cA * aB',  # this one had special tratment wrt rectangles in deleted file porter-duff.rb before the svg ops came in, perhaps that was with good reason? /pippin
+      ['src_in',        'cA * aB',  # this one had special treatment wrt rectangles in deleted file porter-duff.rb before the svg ops came in, perhaps that was with good reason? /pippin
                         'aA * aB'],
       ['dst_in',        'cB * aA',
                         'aA * aB'],
@@ -60,8 +59,10 @@
     ]
 
 file_head1 = '
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 /* no properties */
+
 #else
 '
 
@@ -95,6 +96,24 @@
   return TRUE;
 }
 
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass              *operation_class;
+  GeglOperationPointComposerClass *point_composer_class;
+
+  operation_class      = GEGL_OPERATION_CLASS (klass);
+  point_composer_class = GEGL_OPERATION_POINT_COMPOSER_CLASS (klass);
+
+  point_composer_class->process = process;
+  operation_class->prepare = prepare;
+
+  operation_class->name        = "#{name}";
+  operation_class->categories  = "compositors:porter duff";
+  operation_class->description =
+        "Porter Duff operation #{name} (d = #{c_formula})";
+}
+
 #endif
 '
 
@@ -118,21 +137,16 @@
     file.write copyright
     file.write file_head1
     file.write "
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:porter duff\"
-#define GEGL_CHANT_DESCRIPTION   \"Porter Duff operation #{name} (d = #{c_formula})\"
-
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE        \"#{filename}\"
 
-#include \"gegl-old-chant.h\"
+#include \"gegl-chant.h\"
 "
     file.write file_head2
     file.write "
   for (i = 0; i < n_pixels; i++)
     {
-      int  j;
+      gint   j;
       gfloat aA, aB, aD;
 
       aB = in[3];
@@ -140,13 +154,13 @@
       aD = #{a_formula};
 
       for (j = 0; j < 3; j++)
-          {
-              gfloat cA, cB;
+        {
+          gfloat cA, cB;
 
-              cB = in[j];
-              cA = aux[j];
-              out[j] = #{c_formula};
-          }
+          cB = in[j];
+          cA = aux[j];
+          out[j] = #{c_formula};
+        }
       out[3] = aD;
       in  += 4;
       aux += 4;



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