Commit ad7fa85f authored by Øyvind Kolås's avatar Øyvind Kolås

modified to include the headers for gegl-operation and it's subclesses

* gegl/gegl-plugin.h: modified to include the headers for
gegl-operation and it's subclesses (either by #include or directly
through an ifdef, not sure which direction to take yet)
* gegl/gegl-chant.h: modified to only include gegl-plugin.h
* gegl/gegl-old-chant.h: .. here as well.
* operations/affine/affine.h:
* operations/color/remap.c:
* operations/io/load.c:
* operations/meta/layer.c:
* operations/render/text.c:
* tools/operation_reference.c: modified to not include the
gegl-operation-foo.h's directly, but rely on them being made available
by gegl-plugin.h

svn path=/trunk/; revision=1950
parent 8ba7a69b
2008-02-03 Øyvind Kolås <pippin@gimp.org>
* gegl/gegl-plugin.h: modified to include the headers for
gegl-operation and it's subclesses (either by #include or directly
through an ifdef, not sure which direction to take yet)
* gegl/gegl-chant.h: modified to only include gegl-plugin.h
* gegl/gegl-old-chant.h: .. here as well.
* operations/affine/affine.h:
* operations/color/remap.c:
* operations/io/load.c:
* operations/meta/layer.c:
* operations/render/text.c:
* tools/operation_reference.c: modified to not include the
gegl-operation-foo.h's directly, but rely on them being made available
by gegl-plugin.h
2008-02-02 Øyvind Kolås <pippin@gimp.org>
* NEWS: updated with new changes.
......
......@@ -93,7 +93,6 @@ type_name##_register_type (GTypeModule *type_module) \
#ifdef GEGL_CHANT_TYPE_OPERATION
#include <operation/gegl-operation.h>
struct _GeglChant
{
GeglOperation parent_instance;
......@@ -125,7 +124,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_META);
#endif
#ifdef GEGL_CHANT_TYPE_SOURCE
#include <operation/gegl-operation-source.h>
struct _GeglChant
{
GeglOperationSource parent_instance;
......@@ -141,7 +139,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_SOURCE);
#endif
#ifdef GEGL_CHANT_TYPE_SINK
#include <operation/gegl-operation-sink.h>
struct _GeglChant
{
GeglOperationSink parent_instance;
......@@ -157,7 +154,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_SINK);
#endif
#ifdef GEGL_CHANT_TYPE_FILTER
#include <operation/gegl-operation-filter.h>
struct _GeglChant
{
GeglOperationFilter parent_instance;
......@@ -173,7 +169,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_FILTER);
#endif
#ifdef GEGL_CHANT_TYPE_COMPOSER
#include <operation/gegl-operation-composer.h>
struct _GeglChant
{
GeglOperationComposer parent_instance;
......@@ -190,7 +185,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_COMPOSER);
#endif
#ifdef GEGL_CHANT_TYPE_POINT_FILTER
#include <operation/gegl-operation-point-filter.h>
struct _GeglChant
{
GeglOperationPointFilter parent_instance;
......@@ -207,7 +201,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_POINT_FILTER);
#endif
#ifdef GEGL_CHANT_TYPE_AREA_FILTER
#include <operation/gegl-operation-area-filter.h>
struct _GeglChant
{
GeglOperationAreaFilter parent_instance;
......@@ -223,7 +216,6 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_AREA_FILTER);
#ifdef GEGL_CHANT_TYPE_POINT_COMPOSER
#include <operation/gegl-operation-point-composer.h>
struct _GeglChant
{
GeglOperationPointComposer parent_instance;
......
......@@ -34,57 +34,48 @@
#ifdef GEGL_CHANT_SOURCE
#include <operation/gegl-operation-source.h>
#include <operation/gegl-extension-handler.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationSource
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationSourceClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_SOURCE
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_SOURCE_CLASS
#endif
#ifdef GEGL_CHANT_SINK
#include <operation/gegl-operation-sink.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationSink
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationSinkClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_SINK
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_SINK_CLASS
#endif
#ifdef GEGL_CHANT_FILTER
#include <operation/gegl-operation-filter.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationFilter
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationFilterClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_FILTER
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_FILTER_CLASS
#endif
#ifdef GEGL_CHANT_POINT_FILTER
#include <operation/gegl-operation-point-filter.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationPointFilter
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationPointFilterClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_POINT_FILTER
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_POINT_FILTER_CLASS
#endif
#ifdef GEGL_CHANT_AREA_FILTER
#include <operation/gegl-operation-area-filter.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationAreaFilter
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationAreaFilterClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_AREA_FILTER
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_AREA_FILTER_CLASS
#endif
#ifdef GEGL_CHANT_COMPOSER
#include <operation/gegl-operation-composer.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationComposer
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationComposerClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_COMPOSER
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_COMPOSER_CLASS
#endif
#ifdef GEGL_CHANT_POINT_COMPOSER
#include <operation/gegl-operation-point-composer.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationPointComposer
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationPointComposerClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_POINT_COMPOSER
#define GEGL_CHANT_PARENT_CLASS GEGL_OPERATION_POINT_COMPOSER_CLASS
#endif
#ifdef GEGL_CHANT_META
#include <operation/gegl-operation-meta.h>
#define GEGL_CHANT_PARENT_TypeName GeglOperationMeta
#define GEGL_CHANT_PARENT_TypeNameClass GeglOperationMetaClass
#define GEGL_CHANT_PARENT_TYPE GEGL_TYPE_OPERATION_META
......
This diff is collapsed.
#ifndef __OP_AFFINE_H__
#define __OP_AFFINE_H__
#include <gegl/operation/gegl-operation-filter.h>
#include "matrix.h"
G_BEGIN_DECLS
......
......@@ -16,166 +16,21 @@
* Copyright 2006 Øyvind Kolås
*/
#ifndef __GEGL_OPERATION_REMAP_H__
#define __GEGL_OPERATION_REMAP_H__
#ifdef GEGL_CHANT_PROPERTIES
#include <gegl-plugin.h>
//gegl_chant_string ("xlow", "hm", "low description")
//gegl_chant_string ("xhigh", "hm", "high description")
G_BEGIN_DECLS
#else
#define GEGL_TYPE_OPERATION_REMAP (gegl_operation_remap_get_type ())
#define GEGL_OPERATION_REMAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_REMAP, GeglOperationRemap))
#define GEGL_OPERATION_REMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_OPERATION_REMAP, GeglOperationRemapClass))
#define GEGL_IS_OPERATION_REMAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_REMAP))
#define GEGL_IS_OPERATION_REMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_OPERATION_REMAP))
#define GEGL_OPERATION_REMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_OPERATION_REMAP, GeglOperationRemapClass))
#define GEGL_CHANT_TYPE_OPERATION
#define GEGL_CHANT_C_FILE "remap.c"
typedef struct _GeglOperationRemap GeglOperationRemap;
typedef struct _GeglOperationRemapClass GeglOperationRemapClass;
struct _GeglOperationRemap
{
GeglOperation parent_instance;
};
struct _GeglOperationRemapClass
{
GeglOperationClass parent_class;
};
GType gegl_operation_remap_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GEGL_OPERATION_REMAP_H__ */
/***************************************************************************/
#if 0
#include "gegl-types.h" /* FIXME: this include should not be needed */
#include "graph/gegl-pad.h" /*FIXME: neither should these */
#include "graph/gegl-node.h"
#endif
#include "gegl-chant.h"
#include <math.h>
#include <string.h>
enum
{
PROP_0,
PROP_LOW,
PROP_HIGH,
PROP_INPUT,
PROP_OUTPUT,
};
static gboolean process (GeglOperation *operation,
GeglNodeContext *context,
const gchar *output_prop,
const GeglRectangle *result);
static void attach (GeglOperation *operation);
static void prepare (GeglOperation *operation);
static GeglNode * detect (GeglOperation *operation,
gint x,
gint y);
static GeglRectangle get_defined_region (GeglOperation *operation);
static GeglRectangle compute_input_request (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi);
static GeglRectangle compute_affected_region (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *input_region);
static void get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
G_DEFINE_DYNAMIC_TYPE (GeglOperationRemap, gegl_operation_remap, GEGL_TYPE_OPERATION)
static void
gegl_operation_remap_class_init (GeglOperationRemapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
object_class->get_property = get_property;
object_class->set_property = set_property;
operation_class->name = "remap";
operation_class->categories = "core";
operation_class->no_cache = TRUE;
operation_class->process = process;
operation_class->attach = attach;
operation_class->prepare = prepare;
operation_class->detect = detect;
operation_class->get_defined_region = get_defined_region;
operation_class->compute_input_request = compute_input_request;
operation_class->compute_affected_region = compute_affected_region;
g_object_class_install_property (object_class, PROP_OUTPUT,
g_param_spec_object ("output",
"Output",
"Ouput pad for generated image buffer.",
GEGL_TYPE_BUFFER,
G_PARAM_READABLE |
GEGL_PARAM_PAD_OUTPUT));
g_object_class_install_property (object_class, PROP_LOW,
g_param_spec_object ("input",
"Input",
"Input pad, for image",
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT));
g_object_class_install_property (object_class, PROP_LOW,
g_param_spec_object ("low",
"Low",
"Input pad, for minimum envelope",
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT));
g_object_class_install_property (object_class, PROP_HIGH,
g_param_spec_object ("high",
"High",
"Input pad, for maximum envelope",
GEGL_TYPE_BUFFER,
G_PARAM_READWRITE |
GEGL_PARAM_PAD_INPUT));
}
static void
gegl_operation_remap_class_finalize (GeglOperationRemapClass *klass)
{
}
static void
gegl_operation_remap_init (GeglOperationRemap *self)
{
}
static void get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
}
static void set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
}
static void
attach (GeglOperation *operation)
{
......@@ -206,8 +61,8 @@ detect (GeglOperation *operation,
gint x,
gint y)
{
GeglNode *input_node;
GeglOperation *input_operation;
GeglNode *input_node;
GeglOperation *input_operation;
input_node = gegl_operation_get_source_node (operation, "input");
......@@ -220,6 +75,36 @@ detect (GeglOperation *operation,
return operation->node;
}
static GeglRectangle
get_defined_region (GeglOperation *operation)
{
GeglRectangle result = { 0, 0, 0, 0 };
GeglRectangle *in_rect;
in_rect = gegl_operation_source_get_defined_region (operation, "input");
if (in_rect)
{
result = *in_rect;
}
return result;
}
static GeglRectangle
compute_affected_region (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *input_region)
{
return *input_region;
}
static GeglRectangle
compute_input_request (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
return *roi;
}
static gboolean
process (GeglOperation *operation,
......@@ -231,104 +116,78 @@ process (GeglOperation *operation,
GeglBuffer *low;
GeglBuffer *high;
GeglBuffer *output;
gfloat *buf;
gfloat *min;
gfloat *max;
gint pixels = result->width * result->height;
gint i;
input = gegl_node_context_get_source (context, "input");
low = gegl_node_context_get_source (context, "low");
high = gegl_node_context_get_source (context, "high");
{
gfloat *buf;
gfloat *min;
gfloat *max;
gint pixels = result->width * result->height;
gint i;
buf = g_new (gfloat, pixels * 4);
min = g_new (gfloat, pixels * 3);
max = g_new (gfloat, pixels * 3);
buf = g_new (gfloat, pixels * 4);
min = g_new (gfloat, pixels * 3);
max = g_new (gfloat, pixels * 3);
gegl_buffer_get (input, 1.0, result, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (low, 1.0, result, babl_format ("RGB float"), min, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (high, 1.0, result, babl_format ("RGB float"), max, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (input, 1.0, result, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (low, 1.0, result, babl_format ("RGB float"), min, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_get (high, 1.0, result, babl_format ("RGB float"), max, GEGL_AUTO_ROWSTRIDE);
output = gegl_node_context_get_target (context, "output");
output = gegl_node_context_get_target (context, "output");
for (i = 0; i < pixels; i++)
{
gint c;
for (i = 0; i < pixels; i++)
for (c = 0; c < 3; c++)
{
gint c;
gfloat delta = max[i*3+c]-min[i*3+c];
for (c = 0; c < 3; c++)
if (delta > 0.0001 || delta < -0.0001)
{
gfloat delta = max[i*3+c]-min[i*3+c];
if (delta > 0.0001 || delta < -0.0001)
{
buf[i*4+c] = (buf[i*4+c]-min[i*3+c]) / delta;
}
/*else
buf[i*4+c] = buf[i*4+c];*/
buf[i*4+c] = (buf[i*4+c]-min[i*3+c]) / delta;
}
/*else
buf[i*4+c] = buf[i*4+c];*/
}
}
gegl_buffer_set (output, result, babl_format ("RGBA float"), buf,
GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (output, result, babl_format ("RGBA float"), buf,
GEGL_AUTO_ROWSTRIDE);
g_free (buf);
g_free (min);
g_free (max);
g_free (buf);
g_free (min);
g_free (max);
}
g_object_unref (input);
g_object_unref (high);
g_object_unref (low);
return TRUE;
}
static GeglRectangle
get_defined_region (GeglOperation *operation)
{
GeglRectangle result = { 0, 0, 0, 0 };
GeglRectangle *in_rect;
in_rect = gegl_operation_source_get_defined_region (operation, "input");
if (in_rect)
{
result = *in_rect;
}
return result;
}
static GeglRectangle
compute_affected_region (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *input_region)
static void
operation_class_init (GeglChantClass *klass)
{
return *input_region;
}
GeglOperationClass *operation_class;
static GeglRectangle
compute_input_request (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *roi)
{
return *roi;
}
operation_class = GEGL_OPERATION_CLASS (klass);
static const GeglModuleInfo modinfo =
{
GEGL_MODULE_ABI_VERSION, "remap", "", ""
};
operation_class->process = process;
operation_class->attach = attach;
operation_class->prepare = prepare;
operation_class->detect = detect;
operation_class->get_defined_region = get_defined_region;
operation_class->compute_affected_region = compute_affected_region;
operation_class->compute_input_request = compute_input_request;
G_MODULE_EXPORT const GeglModuleInfo *
gegl_module_query (GTypeModule *module)
{
return &modinfo;
operation_class->name = "remap";
operation_class->categories = "color";
operation_class->description =
"Linearly remap the R,G,B based on per pixel minimum and maximum"
" values from the high/low input pads";
}
G_MODULE_EXPORT gboolean
gegl_module_register (GTypeModule *module)
{
gegl_operation_remap_register_type (module);
return TRUE;
}
#endif
......@@ -24,7 +24,6 @@ gegl_chant_path (path, "", "Path of file to load.")
#define GEGL_CHANT_C_FILE "load.c"
#include "gegl-plugin.h"
#include <operation/gegl-operation-meta.h>
struct _GeglChant
{
......
......@@ -31,7 +31,6 @@ gegl_chant_path(src, "", "source datafile (png, jpg, raw, svg, bmp, tif, ..)")
#else
#include <gegl-plugin.h>
#include <operation/gegl-operation-meta.h>
struct _GeglChant
{
GeglOperationMeta parent_instance;
......
......@@ -36,7 +36,6 @@ gegl_chant_int (height, 0, 1000000, 0,
#else
#include <gegl-plugin.h>
#include <gegl-operation-source.h>
#include <cairo.h>
#include <pango/pango-attributes.h>
#include <pango/pangocairo.h>
......
......@@ -6,9 +6,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "operation/gegl-operation-filter.h"
#include "operation/gegl-operation-source.h"
#include "operation/gegl-operation-composer.h"
static GList *
gegl_operations_build (GList *list, GType type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment