[gegl/pippin/property-keys: 6/10] checkerboard: migrate to new op api



commit 80b625de9d860c8e67231f3750545db1a5591b0b
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu May 15 00:57:26 2014 +0200

    checkerboard: migrate to new op api

 operations/common/checkerboard.c |   96 ++++++++++++++++++++++++--------------
 1 files changed, 61 insertions(+), 35 deletions(-)
---
diff --git a/operations/common/checkerboard.c b/operations/common/checkerboard.c
index 93b1f65..856e50c 100644
--- a/operations/common/checkerboard.c
+++ b/operations/common/checkerboard.c
@@ -20,48 +20,74 @@
 #include <glib/gi18n-lib.h>
 #include <stdlib.h>
 
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_int_ui   (x, _("Width"),
-                     1, G_MAXINT, 16, 1, 256, 1.5,
-                     _("Horizontal width of cells pixels"))
-
-gegl_chant_int_ui   (y, _("Height"),
-                     1, G_MAXINT, 16, 1, 256, 1.5,
-                     _("Vertical width of cells in pixels"))
-
-gegl_chant_int_ui   (x_offset, _("X offset"),
-                     -G_MAXINT, G_MAXINT, 0, -10, 10, 1.0,
-                     _("Horizontal offset (from origin) for start of grid"))
-
-gegl_chant_int_ui   (y_offset, _("Y offset"),
-                     -G_MAXINT, G_MAXINT,  0, -10, 10, 1.0,
-                     _("Vertical offset (from origin) for start of grid"))
-
-gegl_chant_color    (color1, _("Color"),
-                     "black",
-                     _("One of the cell colors (defaults to 'black')"))
-
-gegl_chant_color    (color2, _("Other color"),
-                     "white",
-                     _("The other cell color (defaults to 'white')"))
-
-gegl_chant_format   (format, _("Babl Format"),
-                     _("The babl format of the output"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_int (x,
+     "nick", _("Width"),
+     "min", 1,
+     "max", G_MAXINT,
+     "default", 16,
+     "ui-min", 1,
+     "ui-max", 256,
+     "ui-gamma", 1.5,
+     "blurb", _("Horizontal width of cells pixels"),
+     NULL)
+
+gegl_property_int (y,
+     "nick", _("Height"),
+     "min", 1,
+     "max", G_MAXINT,
+     "default", 16,
+     "ui-min", 1,
+     "ui-max", 256,
+     "ui-gamma", 1.5,
+     "blurb", _("Vertical width of cells pixels"),
+     NULL)
+
+gegl_property_int (x_offset,
+     "nick", _("X offset"),
+     "ui-min", -10,
+     "ui-max", 10,
+     "blurb", _("Horizontal offset (from origin) for start of grid"),
+     NULL)
+
+gegl_property_int (y_offset,
+     "nick", _("Y offset"),
+     "ui-min", -10,
+     "ui-max", 10,
+     "blurb", _("Vertical offset (from origin) for start of grid"),
+     NULL)
+
+gegl_property_color (color1,
+     "nick", _("Color"),
+     "default", "black",
+     "blurb", _("One of the cell colors (defaults to 'black')"),
+     NULL)
+
+gegl_property_color (color2,
+     "nick", _("Color"),
+     "default", "white",
+     "blurb", _("One of the cell colors (defaults to 'white')"),
+     NULL)
+
+gegl_property_format (format,
+    "nick", _("Babl Format"),
+    "blurb", _("The babl format of the output"),
+    NULL)
 
 #else
 
-#define GEGL_CHANT_TYPE_POINT_RENDER
-#define GEGL_CHANT_C_FILE "checkerboard.c"
+#define GEGL_OP_POINT_RENDER
+#define GEGL_OP_C_FILE "checkerboard.c"
 
-#include "gegl-chant.h"
+#include "gegl-op.h"
 #include <gegl-buffer-cl-iterator.h>
 #include <gegl-debug.h>
 
 static void
 prepare (GeglOperation *operation)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o = GEGL_PROPERTIES (operation);
 
   if (o->format)
     gegl_operation_set_format (operation, "output", o->format);
@@ -154,7 +180,7 @@ checkerboard_cl_process (GeglOperation       *operation,
                          const GeglRectangle *roi,
                          gint                 level)
 {
-  GeglChantO   *o           = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o         = GEGL_PROPERTIES (operation);
   const Babl   *out_format  = gegl_operation_get_format (operation, "output");
   const size_t  gbl_size[1] = {roi->height};
   cl_int        cl_err      = 0;
@@ -205,7 +231,7 @@ checkerboard_process (GeglOperation       *operation,
                       const GeglRectangle *roi,
                       gint                 level)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o = GEGL_PROPERTIES (operation);
   const Babl *out_format = gegl_operation_get_format (operation, "output");
   gint        pixel_size = babl_format_get_bytes_per_pixel (out_format);
   guchar     *out_pixel = out_buf;
@@ -308,7 +334,7 @@ operation_source_process (GeglOperation       *operation,
 }
 
 static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
 {
   GeglOperationClass            *operation_class;
   GeglOperationSourceClass      *source_class;


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