gegl r1907 - in trunk: . operations/blur operations/color
- From: kcozens svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r1907 - in trunk: . operations/blur operations/color
- Date: Thu, 24 Jan 2008 20:05:06 +0000 (GMT)
Author: kcozens
Date: Thu Jan 24 20:05:05 2008
New Revision: 1907
URL: http://svn.gnome.org/viewvc/gegl?rev=1907&view=rev
Log:
* operations/blur/box-blur.c:
* operations/blur/gaussian-blur.c: Minor formatting changes and
function re-ordering for consistency with other updated op files.
* operations/color/brightness-contrast.c:
* operations/color/contrast-curve.c:
* operations/color/invert.c:
* operations/color/levels.c:
* operations/color/mono-mixer.c:
* operations/color/stretch-contrast.c:
* operations/color/threshold.c:
* operations/color/value-invert.c:
* operations/color/whitebalance.c: Updated to new chanting API.
Modified:
trunk/ChangeLog
trunk/operations/blur/box-blur.c
trunk/operations/blur/gaussian-blur.c
trunk/operations/color/brightness-contrast.c
trunk/operations/color/contrast-curve.c
trunk/operations/color/invert.c
trunk/operations/color/levels.c
trunk/operations/color/mono-mixer.c
trunk/operations/color/stretch-contrast.c
trunk/operations/color/threshold.c
trunk/operations/color/value-invert.c
trunk/operations/color/whitebalance.c
Modified: trunk/operations/blur/box-blur.c
==============================================================================
--- trunk/operations/blur/box-blur.c (original)
+++ trunk/operations/blur/box-blur.c Thu Jan 24 20:05:05 2008
@@ -17,12 +17,13 @@
*/
#ifdef GEGL_CHANT_PROPERTIES
-gegl_chant_double (radius, 0.0, 200.0, 4.0, "Radius of square pixel region, (width and height will be radius*2+1.")
+gegl_chant_double (radius, 0.0, 200.0, 4.0, "Radius of square pixel region, (width and height will be radius*2+1).")
#else
#define GEGL_CHANT_TYPE_AREA_FILTER
#define GEGL_CHANT_C_FILE "box-blur.c"
+
#include "gegl-chant.h"
static void hor_blur (GeglBuffer *src,
@@ -35,6 +36,20 @@
#include <stdio.h>
+static void tickle (GeglOperation *operation)
+{
+ GeglChantO *o;
+ GeglOperationAreaFilter *op_area;
+
+ op_area = GEGL_OPERATION_AREA_FILTER (operation);
+ o = GEGL_CHANT_PROPERTIES (operation);
+
+ op_area->left =
+ op_area->right =
+ op_area->top =
+ op_area->bottom = ceil (o->radius);
+}
+
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
@@ -224,20 +239,6 @@
#include <math.h>
-static void tickle (GeglOperation *operation)
-{
- GeglChantO *o;
- GeglOperationAreaFilter *op_area;
-
- op_area = GEGL_OPERATION_AREA_FILTER (operation);
- o = GEGL_CHANT_PROPERTIES (operation);
-
- op_area->left =
- op_area->right =
- op_area->top =
- op_area->bottom = ceil (o->radius);
-}
-
static void
operation_class_init (GeglChantClass *klass)
Modified: trunk/operations/blur/gaussian-blur.c
==============================================================================
--- trunk/operations/blur/gaussian-blur.c (original)
+++ trunk/operations/blur/gaussian-blur.c Thu Jan 24 20:05:05 2008
@@ -77,13 +77,22 @@
gint offsetX,
gint offsetY);
+
+static void tickle (GeglOperation *operation)
+{
+ GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ area->left = area->right = ceil (o->std_dev_x * RADIUS_SCALE);
+ area->top = area->bottom = ceil (o->std_dev_y * RADIUS_SCALE);
+}
+
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result)
{
- GeglChantO *o= GEGL_CHANT_PROPERTIES (operation);
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
GeglBuffer *temp;
gdouble B, b[4];
gdouble *cmatrix;
@@ -444,14 +453,6 @@
#include <math.h>
-static void tickle (GeglOperation *operation)
-{
- GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- area->left = area->right = ceil (o->std_dev_x * RADIUS_SCALE);
- area->top = area->bottom = ceil (o->std_dev_y * RADIUS_SCALE);
-}
-
static void
operation_class_init (GeglChantClass *klass)
Modified: trunk/operations/color/brightness-contrast.c
==============================================================================
--- trunk/operations/color/brightness-contrast.c (original)
+++ trunk/operations/color/brightness-contrast.c Thu Jan 24 20:05:05 2008
@@ -18,15 +18,13 @@
/* Followed by this #if ... */
-#if GEGL_CHANT_PROPERTIES
+#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" */
-gegl_chant_double (contrast, -5.0, 5.0, 1.0,
- "Range scale factor")
-gegl_chant_double (brightness, -3.0, 3.0, 0.0,
- "Amount to increase brightness")
+gegl_chant_double (contrast, -5.0, 5.0, 1.0, "Range scale factor")
+gegl_chant_double (brightness, -3.0, 3.0, 0.0, "Amount to increase brightness")
/* this will create the following structure for our use, and register the
* property with the given ranges, default values and a comment for the
@@ -35,48 +33,22 @@
#else
/* Following an else, is then the meta information for this operation */
-#define GEGL_CHANT_NAME brightness_contrast
-/* The name of the operation (with lower case here, _ and - are interchangeable
- * when used by GEGL. */
-#define GEGL_CHANT_SELF "brightness-contrast.c"
-/* we need to specify the name of the source file for gegl-old-chant.height to
- * do it's magic.
- */
-
-
-#define GEGL_CHANT_POINT_FILTER
+#define GEGL_CHANT_TYPE_POINT_FILTER
/* This sets the super class we are deriving from, in this case from the class
* point filter. With a point filter we only need to implement processing for a
* linear buffer
*/
-
-#define GEGL_CHANT_DESCRIPTION "Changes the light level and contrast."
-/* This string shows up in the documentation, and perhaps online help/
- * operation browser/tooltips or similar.
- */
-
-
-#define GEGL_CHANT_CATEGORIES "color"
-/* A colon seperated list of categories/tags for this operation. */
-
-#define GEGL_CHANT_PREPARE
-/* here we specify that we've got our own preparation function, that is
- * run during preparations for processing.
+#define GEGL_CHANT_C_FILE "brightness-contrast.c"
+/* we need to specify the name of the source file for gegl-old-chant.height to
+ * do it's magic.
*/
/* gegl-chant, uses the properties defined at the top, and the configuration
* in the preceding lines to generate a GObject plug-in.
*/
-#include "gegl-old-chant.h"
-
-static void prepare (GeglOperation *operation)
-{
- /* set the babl format this operation prefers to work on */
- gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
+#include "gegl-chant.h"
/* GeglOperationPointFilter gives us a linear buffer to operate on
* in our requested pixel format
@@ -87,12 +59,11 @@
void *out_buf,
glong n_pixels)
{
- GeglChantOperation *self;
- gfloat *pixel;
- glong i;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ gfloat *pixel;
+ glong i;
- self = GEGL_CHANT_OPERATION (op);
- pixel = in_buf;
+ pixel = in_buf;
for (i=0; i<n_pixels; i++)
{
@@ -100,7 +71,7 @@
for (component=0; component<3; component++)
{
gfloat c = pixel[component];
- c = (c - 0.5) * self->contrast + self->brightness + 0.5;
+ c = (c - 0.5) * o->contrast + o->brightness + 0.5;
pixel[component] = c;
}
pixel += 4;
@@ -108,4 +79,29 @@
return TRUE;
}
-#endif /* closing #if GEGL_CHANT_PROPERTIES ... else ... */
+
+static void prepare (GeglOperation *operation)
+{
+ /* set the babl format this operation prefers to work on */
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationPointFilterClass *point_filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+ point_filter_class->process = process;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "brightness-contrast";
+ operation_class->categories = "color";
+ operation_class->description = "Changes the light level and contrast.";
+}
+
+#endif /* closing #ifdef GEGL_CHANT_PROPERTIES ... else ... */
Modified: trunk/operations/color/contrast-curve.c
==============================================================================
--- trunk/operations/color/contrast-curve.c (original)
+++ trunk/operations/color/contrast-curve.c Thu Jan 24 20:05:05 2008
@@ -15,22 +15,17 @@
*
* Copyright 2007 Mark Probst <mark probst gmail com>
*/
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_int (sampling_points, 0, 65536, 0, "Number of curve sampling points. 0 for exact calculation.")
gegl_chant_curve (curve, "The contrast curve.")
#else
-#define GEGL_CHANT_NAME contrast_curve
-#define GEGL_CHANT_SELF "contrast-curve.c"
-#define GEGL_CHANT_DESCRIPTION "Adjusts the contrast of the image according to a curve."
-#define GEGL_CHANT_CATEGORIES "color"
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "contrast-curve.c"
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_PREPARE
-
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
static void prepare (GeglOperation *operation)
{
@@ -46,23 +41,23 @@
void *out_buf,
glong samples)
{
- GeglChantOperation *self;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ gint num_sampling_points;
+ GeglCurve *curve;
gint i;
- gfloat *in = in_buf;
- gfloat *out = out_buf;
- gint num_sampling_points;
+ gfloat *in = in_buf;
+ gfloat *out = out_buf;
gdouble *xs, *ys;
- self = GEGL_CHANT_OPERATION (op);
-
- num_sampling_points = self->sampling_points;
+ num_sampling_points = o->sampling_points;
+ curve = o->curve;
if (num_sampling_points > 0)
{
xs = g_new(gdouble, num_sampling_points);
ys = g_new(gdouble, num_sampling_points);
- gegl_curve_calc_values(self->curve, 0.0, 1.0, num_sampling_points, xs, ys);
+ gegl_curve_calc_values(o->curve, 0.0, 1.0, num_sampling_points, xs, ys);
g_free(xs);
@@ -92,7 +87,7 @@
{
gfloat u = in[0];
- out[0] = gegl_curve_calc_value(self->curve, u);
+ out[0] = gegl_curve_calc_value(curve, u);
out[1]=in[1];
in += 2;
@@ -102,4 +97,23 @@
return TRUE;
}
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationPointFilterClass *point_filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+ point_filter_class->process = process;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "contrast-curve";
+ operation_class->categories = "color";
+ operation_class->description =
+ "Adjusts the contrast of the image according to a curve.";
+}
+
#endif
Modified: trunk/operations/color/invert.c
==============================================================================
--- trunk/operations/color/invert.c (original)
+++ trunk/operations/color/invert.c Thu Jan 24 20:05:05 2008
@@ -16,18 +16,21 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
#ifdef GEGL_CHANT_PROPERTIES
+
/* no properties */
+
#else
-#define GEGL_CHANT_C_FILE "invert.c"
#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "invert.c"
+
#include "gegl-chant.h"
static gboolean
process (GeglOperation *op,
void *in_buf,
void *out_buf,
- glong samples)
+ glong samples)
{
glong i;
gfloat *in = in_buf;
@@ -58,6 +61,7 @@
operation_class = GEGL_OPERATION_CLASS (klass);
point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
point_filter_class->process = process;
operation_class->name = "invert";
Modified: trunk/operations/color/levels.c
==============================================================================
--- trunk/operations/color/levels.c (original)
+++ trunk/operations/color/levels.c Thu Jan 24 20:05:05 2008
@@ -16,7 +16,8 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
gegl_chant_double (in_low, -1.0, 4.0, 0.0,
"Input luminance level to become lowest output")
gegl_chant_double (in_high, -1.0, 4.0, 1.0, "Input luminance level to become white.")
@@ -25,15 +26,10 @@
#else
-#define GEGL_CHANT_NAME levels
-#define GEGL_CHANT_SELF "levels.c"
-
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_DESCRIPTION "Remaps the intensity range of the image"
-
-#define GEGL_CHANT_CATEGORIES "color"
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "levels.c"
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
/* GeglOperationPointFilter gives us a linear buffer to operate on
* in our requested pixel format
@@ -44,26 +40,25 @@
void *out_buf,
glong n_pixels)
{
- GeglChantOperation *self;
- gfloat *pixel;
- gfloat in_range;
- gfloat out_range;
- gfloat in_offset;
- gfloat out_offset;
- gfloat scale;
- glong i;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ gfloat *pixel;
+ gfloat in_range;
+ gfloat out_range;
+ gfloat in_offset;
+ gfloat out_offset;
+ gfloat scale;
+ glong i;
- self = GEGL_CHANT_OPERATION (op);
pixel = in_buf;
- in_offset = self->in_low * 1.0;
- out_offset = self->out_low * 1.0;
- in_range = self->in_high-self->in_low;
- out_range = self->out_high-self->out_low;
+ in_offset = o->in_low * 1.0;
+ out_offset = o->out_low * 1.0;
+ in_range = o->in_high-o->in_low;
+ out_range = o->out_high-o->out_low;
if (in_range == 0.0)
in_range = 0.00000001;
-
+
scale = out_range/in_range;
for (i=0; i<n_pixels; i++)
@@ -76,4 +71,22 @@
return TRUE;
}
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationPointFilterClass *point_filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+ point_filter_class->process = process;
+
+ operation_class->name = "levels";
+ operation_class->categories = "color";
+ operation_class->description =
+ "Remaps the intensity range of the image";
+}
+
#endif
Modified: trunk/operations/color/mono-mixer.c
==============================================================================
--- trunk/operations/color/mono-mixer.c (original)
+++ trunk/operations/color/mono-mixer.c Thu Jan 24 20:05:05 2008
@@ -17,22 +17,32 @@
*/
#ifdef GEGL_CHANT_PROPERTIES
+
gegl_chant_double (red, -10.0, 10.0, 0.5, "Amount of red")
gegl_chant_double (green, -10.0, 10.0, 0.25, "Amount of green")
gegl_chant_double (blue, -10.0, 10.0, 0.25, "Amount of blue")
+
#else
-#define GEGL_CHANT_C_FILE "mono-mixer.c"
#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE "mono-mixer.c"
+
#include "gegl-chant.h"
+static void prepare (GeglOperation *operation)
+{
+ /* set the babl format this operation prefers to work on */
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("YA float"));
+}
+
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
gfloat red = o->red;
gfloat green = o->green;
@@ -73,21 +83,14 @@
return TRUE;
}
-static void prepare (GeglOperation *operation)
-{
- /* set the babl format this operation prefers to work on */
- gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "output", babl_format ("YA float"));
-}
-
static void
operation_class_init (GeglChantClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
- operation_class = GEGL_OPERATION_CLASS (klass);
- filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
filter_class->process = process;
operation_class->prepare = prepare;
Modified: trunk/operations/color/stretch-contrast.c
==============================================================================
--- trunk/operations/color/stretch-contrast.c (original)
+++ trunk/operations/color/stretch-contrast.c Thu Jan 24 20:05:05 2008
@@ -15,20 +15,14 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
-
+#ifdef GEGL_CHANT_PROPERTIES
+
#else
-#define GEGL_CHANT_FILTER
-#define GEGL_CHANT_NAME stretch_contrast
-#define GEGL_CHANT_DESCRIPTION "Scales the components of the buffer to be in the 0.0-1.0 range. This improves images that makes poor use of the available contrast (little contrast, very dark, or very bright images)."
-
-#define GEGL_CHANT_SELF "stretch-contrast.c"
-#define GEGL_CHANT_CLASS_INIT /*< we need to modify the standard class init
- of the super class */
-#define GEGL_CHANT_CATEGORIES "color:enhance"
-#define GEGL_CHANT_PREPARE
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE "stretch-contrast.c"
+
+#include "gegl-chant.h"
static gboolean
inner_process (gdouble min,
@@ -80,6 +74,12 @@
*max = tmax;
}
+static void prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
@@ -126,20 +126,29 @@
return result;
}
-static void prepare (GeglOperation *operation)
-{
- gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
- gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
/* This is called at the end of the gobject class_init function, the
* GEGL_CHANT_CLASS_INIT was needed to make this happen
*
* Here we override the standard passthrough options for the rect
* computations.
*/
-static void class_init (GeglOperationClass *operation_class)
+static void
+operation_class_init (GeglChantClass *klass)
{
+ GeglOperationClass *operation_class;
+ GeglOperationFilterClass *filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
+
+ filter_class->process = process;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "stretch-contrast";
+ operation_class->categories = "color:enhance";
+ operation_class->description =
+ "Scales the components of the buffer to be in the 0.0-1.0 range. This improves images that makes poor use of the available contrast (little contrast, very dark, or very bright images).";
+
operation_class->compute_input_request = compute_input_request;
}
Modified: trunk/operations/color/threshold.c
==============================================================================
--- trunk/operations/color/threshold.c (original)
+++ trunk/operations/color/threshold.c Thu Jan 24 20:05:05 2008
@@ -15,21 +15,17 @@
*
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
gegl_chant_double (value, -10.0, 10.0, 0.5,
"Global threshold level (used when there is no auxiliary input buffer).")
#else
-#define GEGL_CHANT_POINT_COMPOSER
-#define GEGL_CHANT_NAME threshold
-#define GEGL_CHANT_DESCRIPTION "Thresholds the image to white/black based on either the global value set in the value property, or per pixel from the aux input."
-#define GEGL_CHANT_SELF "threshold.c"
-#define GEGL_CHANT_CATEGORIES "color"
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_COMPOSER
+#define GEGL_CHANT_C_FILE "threshold.c"
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
static void prepare (GeglOperation *operation)
{
@@ -45,15 +41,14 @@
void *out_buf,
glong n_pixels)
{
- glong i;
-
gfloat *in = in_buf;
gfloat *out = out_buf;
gfloat *aux = aux_buf;
+ glong i;
if (aux == NULL)
{
- gfloat value = GEGL_CHANT_OPERATION (op)->value;
+ gfloat value = GEGL_CHANT_PROPERTIES (op)->value;
for (i=0; i<n_pixels; i++)
{
gfloat c;
@@ -86,4 +81,24 @@
}
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 = "threshold";
+ operation_class->categories = "color";
+ operation_class->description =
+ "Thresholds the image to white/black based on either the global value"
+ " set in the value property, or per pixel from the aux input.";
+}
+
#endif
Modified: trunk/operations/color/value-invert.c
==============================================================================
--- trunk/operations/color/value-invert.c (original)
+++ trunk/operations/color/value-invert.c Thu Jan 24 20:05:05 2008
@@ -30,17 +30,16 @@
*
*/
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
/* no properties */
+
#else
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_NAME value_invert
-#define GEGL_CHANT_DESCRIPTION "Inverts just the value component, the result is the corresponding `inverted' image."
-#define GEGL_CHANT_SELF "value-invert.c"
-#define GEGL_CHANT_CATEGORIES "color"
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "value-invert.c"
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
static gboolean
process (GeglOperation *op,
@@ -110,5 +109,23 @@
return TRUE;
}
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationPointFilterClass *point_filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+ point_filter_class->process = process;
+
+ operation_class->name = "value-invert";
+ operation_class->categories = "color";
+ operation_class->description =
+ "Inverts just the value component, the result is the corresponding `inverted' image.";
+}
+
#endif
Modified: trunk/operations/color/whitebalance.c
==============================================================================
--- trunk/operations/color/whitebalance.c (original)
+++ trunk/operations/color/whitebalance.c Thu Jan 24 20:05:05 2008
@@ -16,7 +16,8 @@
* Copyright 2006 Ãyvind KolÃs <pippin gimp org>
*/
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
gegl_chant_double (high_a_delta, -2.0, 2.0, 0.0, "")
gegl_chant_double (high_b_delta, -2.0, 2.0, 0.0, "")
gegl_chant_double (low_a_delta, -2.0, 2.0, 0.0, "")
@@ -25,16 +26,10 @@
#else
-#define GEGL_CHANT_NAME whitebalance
-#define GEGL_CHANT_SELF "whitebalance.c"
-
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_DESCRIPTION "Allows changing the whitepoint and blackpoint of an image."
-
-#define GEGL_CHANT_CATEGORIES "color"
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE "whitebalance.c"
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
static void prepare (GeglOperation *operation)
{
@@ -52,31 +47,49 @@
void *out_buf,
glong n_pixels)
{
- GeglChantOperation *self;
- gfloat *pixel;
- gfloat a_base;
- gfloat a_scale;
- gfloat b_base;
- gfloat b_scale;
- glong i;
+ GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ gfloat *pixel;
+ gfloat a_base;
+ gfloat a_scale;
+ gfloat b_base;
+ gfloat b_scale;
+ glong i;
- self = GEGL_CHANT_OPERATION (op);
pixel = in_buf;
- a_scale = (self->high_a_delta - self->low_a_delta);
- a_base = self->low_a_delta;
- b_scale = (self->high_b_delta - self->low_b_delta);
- b_base = self->low_b_delta;
-
+ a_scale = (o->high_a_delta - o->low_a_delta);
+ a_base = o->low_a_delta;
+ b_scale = (o->high_b_delta - o->low_b_delta);
+ b_base = o->low_b_delta;
+
for (i=0; i<n_pixels; i++)
{
pixel[1] += pixel[0] * a_scale + a_base;
pixel[2] += pixel[0] * b_scale + b_base;
- pixel[1] = pixel[1] * self->saturation;
- pixel[2] = pixel[2] * self->saturation;
+ pixel[1] = pixel[1] * o->saturation;
+ pixel[2] = pixel[2] * o->saturation;
pixel += 4;
}
return TRUE;
}
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+ GeglOperationClass *operation_class;
+ GeglOperationPointFilterClass *point_filter_class;
+
+ operation_class = GEGL_OPERATION_CLASS (klass);
+ point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+ point_filter_class->process = process;
+ operation_class->prepare = prepare;
+
+ operation_class->name = "whitebalance";
+ operation_class->categories = "color";
+ operation_class->description =
+ "Allows changing the whitepoint and blackpoint of an image.";
+}
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]