[gegl/pippin/property-keys: 4/16] port a couple of ops to new chanting api



commit fd841f9d1703aa2c18f46159f18a96b8b9bacf37
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed May 14 14:54:59 2014 +0200

    port a couple of ops to new chanting api

 gegl/property-types/gegl-paramspecs.h   |    5 ++-
 operations/common/brightness-contrast.c |   46 +++++++++++++++++++++---------
 operations/common/panorama-projection.c |   47 +++++++++++++++----------------
 3 files changed, 58 insertions(+), 40 deletions(-)
---
diff --git a/gegl/property-types/gegl-paramspecs.h b/gegl/property-types/gegl-paramspecs.h
index 1d3eeb3..dc6d30c 100644
--- a/gegl/property-types/gegl-paramspecs.h
+++ b/gegl/property-types/gegl-paramspecs.h
@@ -385,8 +385,9 @@ GParamSpec * gegl_param_spec_enum_from_vararg (const char *name, GType enum_type
 GParamSpec * gegl_param_spec_color_from_vararg (const char *name, ...);
 GParamSpec * gegl_param_spec_seed_from_vararg (const char *name, ...);
 GParamSpec * gegl_param_spec_object_from_vararg (const char *name, ...);
-GParamSpec *
-gegl_param_spec_format_from_vararg (const char *name, ...);
+GParamSpec * gegl_param_spec_format_from_vararg (const char *name, ...);
+GParamSpec * gegl_param_spec_curve_from_vararg (const char *name, ...);
+GParamSpec * gegl_param_spec_path_from_vararg (const char *name, ...);
 
 
 G_END_DECLS
diff --git a/operations/common/brightness-contrast.c b/operations/common/brightness-contrast.c
index d24e69a..7e9a79c 100644
--- a/operations/common/brightness-contrast.c
+++ b/operations/common/brightness-contrast.c
@@ -19,17 +19,33 @@
 #include "config.h"
 #include <glib/gi18n-lib.h>
 
-/* Followed by this #if ... */
-#ifdef GEGL_CHANT_PROPERTIES
-/* ... are the properties of the filter, these are all scalar values
- * (doubles), the the parameters are:
- *       property name,   min,   max, default, "description of property"
+#ifdef GEGL_PROPERTIES
+
+/*  Here in the top of the file the properties of the operation is declared,
+ *  this causes the declaration of a structure for containing the data.
  */
 
-gegl_chant_double_ui (contrast, _("Contrast"), -5.0, 5.0, 1.0, 0.0, 2.0, 1.0,
-                   _("Range scale factor"))
-gegl_chant_double_ui (brightness, _("Brightness"), -3.0, 3.0, 0.0, -1.0, 1.0, 1.0,
-                   _("Amount to increase brightness"))
+gegl_property_double (contrast,
+   "nick", _("Contrast"), 
+   "min"   , -5.0,
+   "max",     5.0,
+   "default", 1.0,
+   "ui-min",  0.0,
+   "ui-max",  2.0,
+   "ui-gamma", 1.0,
+   "blurb", _("Range scale factor"),
+   NULL)
+
+gegl_property_double (brightness,
+   "nick", _("Brightness"), 
+   "min", -3.0,
+   "max", 3.0,
+   "default", 0.0,
+   "ui-min", -1.0,
+   "ui-max",  1.0,
+   "ui-gamma", 1.0,
+   "blurb", _("Amount to increase brightness"),
+   NULL)
 
 /* this will create the instance structure for our use, and register the
  * property with the given ranges, default values and a comment for the
@@ -42,19 +58,21 @@ gegl_chant_double_ui (brightness, _("Brightness"), -3.0, 3.0, 0.0, -1.0, 1.0, 1.
  * brightness contrast the best base class is the POINT_FILTER base
  * class.
  */
-#define GEGL_CHANT_TYPE_POINT_FILTER
+
+#define GEGL_OP_Parent  GeglOperationPointFilter
+#define GEGL_OP_PARENT  GEGL_TYPE_OPERATION_POINT_FILTER
 
 /* We specify the file we're in, this is needed to make the code
  * generation for the properties work.
  */
-#define GEGL_CHANT_C_FILE       "brightness-contrast.c"
+#define GEGL_OP_C_FILE       "brightness-contrast.c"
 
 /* Including gegl-chant.h creates most of the GObject boiler plate
  * needed, creating a GeglChant instance structure a GeglChantClass
  * structure for our operation, as well as the needed code to register
  * our new gobject with GEGL.
  */
-#include "gegl-chant.h"
+#include "gegl-op.h"
 
 /* prepare() is called on each operation providing data to a node that
  * is requested to provide a rendered result. When prepare is called
@@ -81,7 +99,7 @@ process (GeglOperation       *op,
   /* Retrieve a pointer to GeglChantO structure which contains all the
    * chanted properties
    */
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+  GeglProperties *o = GEGL_PROPERTIES (op);
   gfloat     * GEGL_ALIGNED in_pixel;
   gfloat     * GEGL_ALIGNED out_pixel;
   gfloat      brightness, contrast;
@@ -112,7 +130,7 @@ process (GeglOperation       *op,
  * (template) in the GObject OO framework.
  */
 static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
 {
   GeglOperationClass            *operation_class;
   GeglOperationPointFilterClass *point_filter_class;
diff --git a/operations/common/panorama-projection.c b/operations/common/panorama-projection.c
index 37ad374..46b4554 100644
--- a/operations/common/panorama-projection.c
+++ b/operations/common/panorama-projection.c
@@ -18,32 +18,31 @@
 
 #include <math.h>
 
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double (pan, _("pan"), -180.0, 360, 0.0,
-       _("camera pan"))
-gegl_chant_double (tilt, _("tilt"), -180.0, 180.0, 0.0,
-       _("camera tilt"))
-gegl_chant_double (spin, _("spin"), -360.0, 360.0, 0.0,
-       _("rotation of camera"))
-gegl_chant_double (zoom, _("zoom"), 0.01, 1000.0, 100.0, 
-       _("zoom of camera"))
-gegl_chant_int (width, _("width"), -1, 10000, -1, _("output buffer width, -1 for same as input"))
-gegl_chant_int (height, _("height"), -1, 10000, -1, _("input buffer height, -1 for same as input"))
-
-gegl_chant_boolean (little_planet, _("little planet"), FALSE, _("use the pan/tilt location as center for a 
stereographic/little planet projection."))
-
-gegl_chant_enum (sampler_type, _("Sampler"), GeglSamplerType, gegl_sampler_type,
-                 GEGL_SAMPLER_NEAREST, _("Image resampling method to use"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (pan, "min", -180.0, "max", 360.0, NULL)
+gegl_property_double (tilt, "min", -180.0, "max", 180.0, NULL)
+gegl_property_double (spin, "min", -360.0, "max", 360.0, NULL)
+gegl_property_double (zoom, "min", 0.01, "max", 1000.0, "default", 100.0, NULL)
+gegl_property_int    (width, "min", -1, "max", 10000, "default", -1, NULL)
+gegl_property_int    (height, "min", -1, "max", 10000, "default", -1, NULL)
+gegl_property_boolean (little_planet, "default", FALSE, "blurb", _("use the pan/tilt location as center for 
a stereographic/little planet projection."), NULL)
+
+gegl_property_enum (sampler_type,
+                    GeglSamplerType, gegl_sampler_type,
+                    "default", GEGL_SAMPLER_NEAREST,
+                    "blurb", _("Image resampling method to use"),
+                    NULL)
 
 #else
 
-#define GEGL_CHANT_TYPE_FILTER
-#define GEGL_CHANT_C_FILE "panorama-projection.c"
+#define GEGL_OP_Parent  GeglOperationFilter
+#define GEGL_OP_PARENT  GEGL_TYPE_OPERATION_FILTER
+#define GEGL_OP_C_FILE "panorama-projection.c"
 
 #include "config.h"
 #include <glib/gi18n-lib.h>
-#include "gegl-chant.h"
+#include "gegl-op.h"
 
 //#include "speedmath.inc"
 
@@ -277,7 +276,7 @@ prepare (GeglOperation *operation)
 static GeglRectangle
 get_bounding_box (GeglOperation *operation)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o = GEGL_PROPERTIES (operation);
   GeglRectangle result = {0,0,0,0};
 
   if (o->width <= 0 || o->height <= 0)
@@ -306,7 +305,7 @@ get_bounding_box (GeglOperation *operation)
 static void prepare_transform2 (Transform *transform,
                                 GeglOperation *operation)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o = GEGL_PROPERTIES (operation);
   GeglRectangle in_rect = *gegl_operation_source_get_bounding_box (operation, "input");
 
   prepare_transform (transform, 
@@ -332,7 +331,7 @@ process (GeglOperation       *operation,
          const GeglRectangle *result,
          gint                 level)
 {
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglProperties *o = GEGL_PROPERTIES (operation);
   Transform           transform;
   const Babl         *format_io;
   GeglSampler        *sampler;
@@ -474,7 +473,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]