gegl r1920 - in trunk: . operations/workshop/generated



Author: kcozens
Date: Mon Jan 28 02:32:31 2008
New Revision: 1920
URL: http://svn.gnome.org/viewvc/gegl?rev=1920&view=rev

Log:
* operations/workshop/generated/blend.rb: Updated to new chanting API.


Modified:
   trunk/ChangeLog
   trunk/operations/workshop/generated/blend.rb

Modified: trunk/operations/workshop/generated/blend.rb
==============================================================================
--- trunk/operations/workshop/generated/blend.rb	(original)
+++ trunk/operations/workshop/generated/blend.rb	Mon Jan 28 02:32:31 2008
@@ -3,13 +3,27 @@
 copyright = '
 /* !!!! AUTOGENERATED FILE generated by blend.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>
  *
  * The formulas used for the blend modes are from:
  *     http://www.pegtop.net/delphi/articles/blendmodes/
  *
+ * !!!! AUTOGENERATED FILE !!!!!
  */'
 
 a = [
@@ -21,13 +35,13 @@
       ['negation',      '1.0 - fabs(1.0-cA-cB)'],
       #['exclusion',     'cA + cB - 2*cA*cB'],
       #['overlay',       'cA<0.5?2*(cA*cB):1.0-2*(1.0-cA)*(1.0-cB)'],
-      #['hard_light',    'cB<0.5?2*(cA*cB):1.0-2*(1.0-cA)*(1.0-cB)'],
-      #['soft_light',    '2*cA*cB+cA*cA-2*cA*cA*cB'],
+      #['hard-light',    'cB<0.5?2*(cA*cB):1.0-2*(1.0-cA)*(1.0-cB)'],
+      #['soft-light',    '2*cA*cB+cA*cA-2*cA*cA*cB'],
       #['color_dodge',   'cA / (1.0 - cB)'],
-      ['soft_dodge',    '(cA+cB<1.0)?0.5*cA / (1.0 - cB):1.0-0.5*(1.0 - cB)/cA'],
+      ['soft-dodge',    '(cA+cB<1.0)?0.5*cA / (1.0 - cB):1.0-0.5*(1.0 - cB)/cA'],
       #['color_burn',    'cB<=0.0?0.0:1.0-(1.0-cA)/cB'],
-      ['soft_burn',     '(cA+cB<1.0)?0.5*cB / (1.0 - cA):1.0-0.5*(1.0 - cA) / cB'],
-      ['blend_reflect', 'cB>=1.0?1.0:cA*cA / (1.0-cB)'],
+      ['soft-burn',     '(cA+cB<1.0)?0.5*cB / (1.0 - cA):1.0-0.5*(1.0 - cA) / cB'],
+      ['blend-reflect', 'cB>=1.0?1.0:cA*cA / (1.0-cB)'],
       ['subtractive',   'cA+cB-1.0']
     ]
 
@@ -47,20 +61,17 @@
 
     file.write copyright
     file.write "
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 /* no properties */
-#else
 
-#define GEGL_CHANT_NAME          #{name}
-#define GEGL_CHANT_SELF          \"#{filename}\"
-#define GEGL_CHANT_CATEGORIES    \"compositors:blend\"
-#define GEGL_CHANT_DESCRIPTION   \"Image blending operation '#{name}' (<tt>c = #{formula}</tt>)\"
+#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 \"math.h\"
+#include \"gegl-chant.h\"
+#include <math.h>
 
 static void prepare (GeglOperation *self)
 {
@@ -71,46 +82,64 @@
   gegl_operation_set_format (self, \"output\", format);
 }
 
-
-
 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 *in  = in_buf;
   gfloat *aux = aux_buf;
   gfloat *out = out_buf;
+  gint    i;
 
-  if (aux==NULL)
+  if (aux == NULL)
     return TRUE;
 
-  for (i=0; i<n_pixels; i++)
+  for (i = 0; i < n_pixels; i++)
     {
-      int  j;
       gfloat aA, aB;
+      gint   j;
 
-      aA=in[3];
-      aB=aux[3];
-      for (j=0; j<3; j++)
-          {
-              gfloat cA, cB;
-
-              cA=in[j];
-              cB=aux[j];
-              out[j] = cA + (#{formula}-cA) * cB;
-          }
+      aA = in[3];
+      aB = aux[3];
+      for (j = 0; j < 3; j++)
+        {
+          gfloat cA, cB;
+
+          cA = in[j];
+          cB = aux[j];
+          out[j] = cA + (#{formula}-cA) * cB;
+        }
       out[j] = aA;
       in  += 4;
       aux += 4;
       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:blend\";
+  operation_class->description =
+        \"Image blending operation '#{name}' (<tt>c = #{formula}</tt>)\";
+}
+
 #endif
 "
 



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