[gegl/pippin/property-keys: 4/11] emboss: migrate to new op api



commit fde2b0b9e7b74dec7f98769f0e703dce62800754
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu May 15 00:56:34 2014 +0200

    emboss: migrate to new op api

 operations/common/emboss.c |   74 +++++++++++++++++++++++++++----------------
 1 files changed, 46 insertions(+), 28 deletions(-)
---
diff --git a/operations/common/emboss.c b/operations/common/emboss.c
index 3ae1813..3110c9f 100644
--- a/operations/common/emboss.c
+++ b/operations/common/emboss.c
@@ -20,35 +20,53 @@
 #include "config.h"
 #include <glib/gi18n-lib.h>
 
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_register_enum (gegl_emboss_type)
-  enum_value (GEGL_EMBOSS_TYPE_EMBOSS,  "Emboss")
-  enum_value (GEGL_EMBOSS_TYPE_BUMPMAP, "Bumpmap")
-gegl_chant_register_enum_end (GeglEmbossType)
-
-gegl_chant_enum   (type, _("Emboss Type"),
-                   GeglEmbossType, gegl_emboss_type, GEGL_EMBOSS_TYPE_EMBOSS,
-                   _("Emboss or Bumpmap"))
-
-gegl_chant_double (azimuth, _("Azimuth"),
-                   0.0, 360.0, 30.0,
-                   _("The light angle (degrees)"))
-
-gegl_chant_double (elevation, _("Elevation"),
-                   0.0, 180.0, 45.0,
-                   _("The elevation angle (degrees)"))
-
-gegl_chant_int    (depth, _("Depth"),
-                   1, 100, 20,
-                   _("The filter width"))
+#ifdef GEGL_PROPERTIES
+
+gegl_enum_start (gegl_emboss_type)
+  gegl_enum_value (GEGL_EMBOSS_TYPE_EMBOSS,  "Emboss")
+  gegl_enum_value (GEGL_EMBOSS_TYPE_BUMPMAP, "Bumpmap")
+gegl_enum_end (GeglEmbossType)
+
+gegl_property_enum (
+    type,
+    GeglEmbossType, gegl_emboss_type, GEGL_EMBOSS_TYPE_EMBOSS,
+    "nick",  _("Emboss Type"),
+    "blurb", _("Emboss or Bumpmap"),
+    NULL)
+
+gegl_property_double (
+    azimuth,
+    "nick",   _("Azimuth"),
+    "min",      0.0,
+    "max",    360.0,
+    "default", 30.0,
+    "blurb",  _("The light angle (degrees)"),
+    NULL)
+
+gegl_property_double (
+    elevation,
+    "nick",  _("Elevation"),
+    "min",      0.0,
+    "max",    180.0,
+    "default", 45.0,
+    "blurb", _("The elevation angle (degrees)"),
+    NULL)
+
+gegl_property_int (
+    depth,
+    "nick", _("Depth"),
+    "min",      1,
+    "max",    100,
+    "default", 20,
+    "blurb", _("The filter width"),
+    NULL)
 
 #else
 
-#define GEGL_CHANT_TYPE_AREA_FILTER
-#define GEGL_CHANT_C_FILE "emboss.c"
+#define GEGL_OP_AREA_FILTER
+#define GEGL_OP_C_FILE "emboss.c"
 
-#include "gegl-chant.h"
+#include "gegl-op.h"
 #include <math.h>
 #include <stdio.h>
 
@@ -169,7 +187,7 @@ emboss (gfloat              *src_buf,
 static void
 prepare (GeglOperation *operation)
 {
-  GeglChantO              *o       = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties          *o       = GEGL_PROPERTIES (operation);
   GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
 
   op_area->left = op_area->right = op_area->top = op_area->bottom = 3;
@@ -189,7 +207,7 @@ process (GeglOperation       *operation,
          const GeglRectangle *result,
          gint                 level)
 {
-  GeglChantO              *o       = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties          *o       = GEGL_PROPERTIES (operation);
   GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
 
   GeglRectangle  rect;
@@ -240,7 +258,7 @@ process (GeglOperation       *operation,
 }
 
 static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
 {
   GeglOperationClass       *operation_class;
   GeglOperationFilterClass *filter_class;


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