[gegl/pippin/property-keys: 10/10] brightness-contrast: migrate to new op api
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/pippin/property-keys: 10/10] brightness-contrast: migrate to new op api
- Date: Wed, 14 May 2014 23:01:50 +0000 (UTC)
commit b48555ca83b0c34e00b6f86f8dd527ee1eaa940f
Author: Øyvind Kolås <pippin gimp org>
Date: Thu May 15 00:59:36 2014 +0200
brightness-contrast: migrate to new op api
operations/common/brightness-contrast.c | 46 +++++++++++++++++++++---------
1 files changed, 32 insertions(+), 14 deletions(-)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]