mirror of https://github.com/GNOME/gimp.git
app/gegl/Makefile.am app/gegl/gegl-types.h new parent class for all image
2008-01-25 Michael Natterer <mitch@gimp.org> * app/gegl/Makefile.am * app/gegl/gegl-types.h * app/gegl/gimpoperationpointfilter.[ch]: new parent class for all image map operations. Features a "config" member and "public" get_property() and set_property() functions to be used by subclasses. * app/gegl/gimpoperationcolorbalance.[ch] * app/gegl/gimpoperationcolorize.[ch] * app/gegl/gimpoperationcurves.[ch] * app/gegl/gimpoperationhuesaturation.[ch] * app/gegl/gimpoperationlevels.[ch] * app/gegl/gimpoperationposterize.[ch] * app/gegl/gimpoperationthreshold.[ch]: derive from GimpOperationPointFilter, remove "config" members, remove finalize(), get_property() and set_property() implementations and use the ones provided by the parent class. svn path=/trunk/; revision=24713
This commit is contained in:
parent
e79955d9ad
commit
a85213cd5f
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2008-01-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gegl/Makefile.am
|
||||
* app/gegl/gegl-types.h
|
||||
* app/gegl/gimpoperationpointfilter.[ch]: new parent class for all
|
||||
image map operations. Features a "config" member and "public"
|
||||
get_property() and set_property() functions to be used by
|
||||
subclasses.
|
||||
|
||||
* app/gegl/gimpoperationcolorbalance.[ch]
|
||||
* app/gegl/gimpoperationcolorize.[ch]
|
||||
* app/gegl/gimpoperationcurves.[ch]
|
||||
* app/gegl/gimpoperationhuesaturation.[ch]
|
||||
* app/gegl/gimpoperationlevels.[ch]
|
||||
* app/gegl/gimpoperationposterize.[ch]
|
||||
* app/gegl/gimpoperationthreshold.[ch]: derive from
|
||||
GimpOperationPointFilter, remove "config" members, remove
|
||||
finalize(), get_property() and set_property() implementations and
|
||||
use the ones provided by the parent class.
|
||||
|
||||
2008-01-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gegl/Makefile.am
|
||||
|
|
|
@ -35,6 +35,8 @@ libappgegl_a_SOURCES = \
|
|||
gimpoperationhuesaturation.h \
|
||||
gimpoperationlevels.c \
|
||||
gimpoperationlevels.h \
|
||||
gimpoperationpointfilter.c \
|
||||
gimpoperationpointfilter.h \
|
||||
gimpoperationposterize.c \
|
||||
gimpoperationposterize.h \
|
||||
gimpoperationthreshold.c \
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef struct _GimpOperationCurves GimpOperationCurves;
|
|||
typedef struct _GimpOperationDesaturate GimpOperationDesaturate;
|
||||
typedef struct _GimpOperationHueSaturation GimpOperationHueSaturation;
|
||||
typedef struct _GimpOperationLevels GimpOperationLevels;
|
||||
typedef struct _GimpOperationPointFilter GimpOperationPointFilter;
|
||||
typedef struct _GimpOperationPosterize GimpOperationPosterize;
|
||||
typedef struct _GimpOperationThreshold GimpOperationThreshold;
|
||||
typedef struct _GimpOperationTileSink GimpOperationTileSink;
|
||||
|
|
|
@ -32,51 +32,34 @@
|
|||
#include "gimpoperationcolorbalance.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_color_balance_finalize (GObject *object);
|
||||
static void gimp_operation_color_balance_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_color_balance_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_color_balance_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_color_balance_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationColorBalance, gimp_operation_color_balance,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_color_balance_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_color_balance_class_init (GimpOperationColorBalanceClass * klass)
|
||||
gimp_operation_color_balance_class_init (GimpOperationColorBalanceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_color_balance_finalize;
|
||||
object_class->set_property = gimp_operation_color_balance_set_property;
|
||||
object_class->get_property = gimp_operation_color_balance_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_color_balance_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-color-balance");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -90,62 +73,6 @@ gimp_operation_color_balance_init (GimpOperationColorBalance *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_color_balance_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_color_balance_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_color_balance_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gfloat
|
||||
gimp_operation_color_balance_map (gfloat value,
|
||||
gdouble shadows,
|
||||
|
@ -188,11 +115,11 @@ gimp_operation_color_balance_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationColorBalance *self = GIMP_OPERATION_COLOR_BALANCE (operation);
|
||||
GimpColorBalanceConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpColorBalanceConfig *config = GIMP_COLOR_BALANCE_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#define __GIMP_OPERATION_COLOR_BALANCE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_COLOR_BALANCE (gimp_operation_color_balance_get_type ())
|
||||
|
@ -39,14 +38,12 @@ typedef struct _GimpOperationColorBalanceClass GimpOperationColorBalanceClass;
|
|||
|
||||
struct _GimpOperationColorBalance
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpColorBalanceConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationColorBalanceClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -31,51 +31,34 @@
|
|||
#include "gimpoperationcolorize.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_colorize_finalize (GObject *object);
|
||||
static void gimp_operation_colorize_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_colorize_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_colorize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_colorize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationColorize, gimp_operation_colorize,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_colorize_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_colorize_class_init (GimpOperationColorizeClass * klass)
|
||||
gimp_operation_colorize_class_init (GimpOperationColorizeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_colorize_finalize;
|
||||
object_class->set_property = gimp_operation_colorize_set_property;
|
||||
object_class->get_property = gimp_operation_colorize_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_colorize_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-colorize");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -89,74 +72,21 @@ gimp_operation_colorize_init (GimpOperationColorize *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_colorize_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationColorize *self = GIMP_OPERATION_COLORIZE (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_colorize_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationColorize *self = GIMP_OPERATION_COLORIZE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_colorize_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationColorize *self = GIMP_OPERATION_COLORIZE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_operation_colorize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationColorize *self = GIMP_OPERATION_COLORIZE (operation);
|
||||
GimpColorizeConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
GimpHSL hsl;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpColorizeConfig *config = GIMP_COLORIZE_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
GimpHSL hsl;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
hsl.h = config->hue;
|
||||
hsl.s = config->saturation;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef __GIMP_OPERATION_COLORIZE_H__
|
||||
#define __GIMP_OPERATION_COLORIZE_H__
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_COLORIZE (gimp_operation_colorize_get_type ())
|
||||
|
@ -38,14 +38,12 @@ typedef struct _GimpOperationColorizeClass GimpOperationColorizeClass;
|
|||
|
||||
struct _GimpOperationColorize
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpColorizeConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationColorizeClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,51 +32,34 @@
|
|||
#include "gimpoperationcurves.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_curves_finalize (GObject *object);
|
||||
static void gimp_operation_curves_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_curves_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_curves_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_curves_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationCurves, gimp_operation_curves,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_curves_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_curves_class_init (GimpOperationCurvesClass * klass)
|
||||
gimp_operation_curves_class_init (GimpOperationCurvesClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_curves_finalize;
|
||||
object_class->set_property = gimp_operation_curves_set_property;
|
||||
object_class->get_property = gimp_operation_curves_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_curves_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-curves");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -90,62 +73,6 @@ gimp_operation_curves_init (GimpOperationCurves *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_curves_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
gimp_operation_curves_map (gdouble value,
|
||||
GimpCurve *curve)
|
||||
|
@ -176,11 +103,11 @@ gimp_operation_curves_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationCurves *self = GIMP_OPERATION_CURVES (operation);
|
||||
GimpCurvesConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#define __GIMP_OPERATION_CURVES_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_CURVES (gimp_operation_curves_get_type ())
|
||||
|
@ -39,14 +38,12 @@ typedef struct _GimpOperationCurvesClass GimpOperationCurvesClass;
|
|||
|
||||
struct _GimpOperationCurves
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpCurvesConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationCurvesClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,51 +32,34 @@
|
|||
#include "gimpoperationhuesaturation.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_hue_saturation_finalize (GObject *object);
|
||||
static void gimp_operation_hue_saturation_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_hue_saturation_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_hue_saturation_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_hue_saturation_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationHueSaturation, gimp_operation_hue_saturation,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_hue_saturation_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_hue_saturation_class_init (GimpOperationHueSaturationClass * klass)
|
||||
gimp_operation_hue_saturation_class_init (GimpOperationHueSaturationClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_hue_saturation_finalize;
|
||||
object_class->set_property = gimp_operation_hue_saturation_set_property;
|
||||
object_class->get_property = gimp_operation_hue_saturation_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_hue_saturation_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-hue-saturation");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -90,62 +73,6 @@ gimp_operation_hue_saturation_init (GimpOperationHueSaturation *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_hue_saturation_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_hue_saturation_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_hue_saturation_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
map_hue (GimpHueSaturationConfig *config,
|
||||
GimpHueRange range,
|
||||
|
@ -200,12 +127,15 @@ gimp_operation_hue_saturation_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationHueSaturation *self = GIMP_OPERATION_HUE_SATURATION (operation);
|
||||
GimpHueSaturationConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
gfloat overlap = config->overlap / 2.0;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpHueSaturationConfig *config = GIMP_HUE_SATURATION_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
gfloat overlap = config->overlap / 2.0;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef __GIMP_OPERATION_HUE_SATURATION_H__
|
||||
#define __GIMP_OPERATION_HUE_SATURATION_H__
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_HUE_SATURATION (gimp_operation_hue_saturation_get_type ())
|
||||
|
@ -38,14 +38,12 @@ typedef struct _GimpOperationHueSaturationClass GimpOperationHueSaturationClass;
|
|||
|
||||
struct _GimpOperationHueSaturation
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpHueSaturationConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationHueSaturationClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,51 +32,34 @@
|
|||
#include "gimpoperationlevels.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_levels_finalize (GObject *object);
|
||||
static void gimp_operation_levels_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_levels_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_levels_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_levels_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationLevels, gimp_operation_levels,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_levels_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_levels_class_init (GimpOperationLevelsClass * klass)
|
||||
gimp_operation_levels_class_init (GimpOperationLevelsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_levels_finalize;
|
||||
object_class->set_property = gimp_operation_levels_set_property;
|
||||
object_class->get_property = gimp_operation_levels_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_levels_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-levels");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -90,62 +73,6 @@ gimp_operation_levels_init (GimpOperationLevels *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_levels_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationLevels *self = GIMP_OPERATION_LEVELS (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_levels_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationLevels *self = GIMP_OPERATION_LEVELS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_levels_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationLevels *self = GIMP_OPERATION_LEVELS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
gimp_operation_levels_map (gdouble value,
|
||||
gdouble gamma,
|
||||
|
@ -183,11 +110,11 @@ gimp_operation_levels_process (GeglOperation *operation,
|
|||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationLevels *self = GIMP_OPERATION_LEVELS (operation);
|
||||
GimpLevelsConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpLevelsConfig *config = GIMP_LEVELS_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
@ -252,4 +179,3 @@ gimp_operation_levels_map_input (GimpLevelsConfig *config,
|
|||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#define __GIMP_OPERATION_LEVELS_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_LEVELS (gimp_operation_levels_get_type ())
|
||||
|
@ -39,14 +38,12 @@ typedef struct _GimpOperationLevelsClass GimpOperationLevelsClass;
|
|||
|
||||
struct _GimpOperationLevels
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpLevelsConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationLevelsClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpoperationpointfilter.c
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
static void gimp_operation_point_filter_finalize (GObject *object);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationPointFilter, gimp_operation_point_filter,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_point_filter_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_point_filter_class_init (GimpOperationPointFilterClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_point_filter_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_point_filter_init (GimpOperationPointFilter *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_point_filter_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationPointFilter *self = GIMP_OPERATION_POINT_FILTER (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_operation_point_filter_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationPointFilter *self = GIMP_OPERATION_POINT_FILTER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case GIMP_OPERATION_POINT_FILTER_PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_operation_point_filter_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationPointFilter *self = GIMP_OPERATION_POINT_FILTER (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case GIMP_OPERATION_POINT_FILTER_PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpoperationpointfilter.h
|
||||
* Copyright (C) 2007 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_OPERATION_POINT_FILTER_H__
|
||||
#define __GIMP_OPERATION_POINT_FILTER_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_0,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_POINT_FILTER (gimp_operation_point_filter_get_type ())
|
||||
#define GIMP_OPERATION_POINT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_POINT_FILTER, GimpOperationPointFilter))
|
||||
#define GIMP_OPERATION_POINT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_POINT_FILTER, GimpOperationPointFilterClass))
|
||||
#define GIMP_IS_OPERATION_POINT_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_POINT_FILTER))
|
||||
#define GIMP_IS_OPERATION_POINT_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_POINT_FILTER))
|
||||
#define GIMP_OPERATION_POINT_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_POINT_FILTER, GimpOperationPointFilterClass))
|
||||
|
||||
|
||||
typedef struct _GimpOperationPointFilterClass GimpOperationPointFilterClass;
|
||||
|
||||
struct _GimpOperationPointFilter
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GObject *config;
|
||||
};
|
||||
|
||||
struct _GimpOperationPointFilterClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_operation_point_filter_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_operation_point_filter_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
void gimp_operation_point_filter_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
#endif /* __GIMP_OPERATION_POINT_FILTER_H__ */
|
|
@ -32,51 +32,34 @@
|
|||
#include "gimpposterizeconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_posterize_finalize (GObject *object);
|
||||
static void gimp_operation_posterize_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_posterize_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_posterize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_posterize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationPosterize, gimp_operation_posterize,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_posterize_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_posterize_class_init (GimpOperationPosterizeClass * klass)
|
||||
gimp_operation_posterize_class_init (GimpOperationPosterizeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_posterize_finalize;
|
||||
object_class->set_property = gimp_operation_posterize_set_property;
|
||||
object_class->get_property = gimp_operation_posterize_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_posterize_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-posterize");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -90,74 +73,21 @@ gimp_operation_posterize_init (GimpOperationPosterize *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_posterize_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationPosterize *self = GIMP_OPERATION_POSTERIZE (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_posterize_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationPosterize *self = GIMP_OPERATION_POSTERIZE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_posterize_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationPosterize *self = GIMP_OPERATION_POSTERIZE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_operation_posterize_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationPosterize *self = GIMP_OPERATION_POSTERIZE (operation);
|
||||
GimpPosterizeConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
gfloat levels = config->levels - 1.0;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpPosterizeConfig *config = GIMP_POSTERIZE_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
gfloat levels = config->levels - 1.0;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
||||
for (sample = 0; sample < samples; sample++)
|
||||
{
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#define __GIMP_OPERATION_POSTERIZE_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_POSTERIZE (gimp_operation_posterize_get_type ())
|
||||
|
@ -39,14 +38,12 @@ typedef struct _GimpOperationPosterizeClass GimpOperationPosterizeClass;
|
|||
|
||||
struct _GimpOperationPosterize
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpPosterizeConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationPosterizeClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -31,51 +31,34 @@
|
|||
#include "gimpthresholdconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CONFIG
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_threshold_finalize (GObject *object);
|
||||
static void gimp_operation_threshold_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_threshold_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_threshold_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_threshold_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationThreshold, gimp_operation_threshold,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_threshold_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_class_init (GimpOperationThresholdClass * klass)
|
||||
gimp_operation_threshold_class_init (GimpOperationThresholdClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_operation_threshold_finalize;
|
||||
object_class->set_property = gimp_operation_threshold_set_property;
|
||||
object_class->get_property = gimp_operation_threshold_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
point_class->process = gimp_operation_threshold_process;
|
||||
|
||||
gegl_operation_class_set_name (operation_class, "gimp-threshold");
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONFIG,
|
||||
g_object_class_install_property (object_class,
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
|
@ -89,73 +72,17 @@ gimp_operation_threshold_init (GimpOperationThreshold *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_finalize (GObject *object)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (object);
|
||||
|
||||
if (self->config)
|
||||
{
|
||||
g_object_unref (self->config);
|
||||
self->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
g_value_set_object (value, self->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_threshold_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CONFIG:
|
||||
if (self->config)
|
||||
g_object_unref (self->config);
|
||||
self->config = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_operation_threshold_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationThreshold *self = GIMP_OPERATION_THRESHOLD (operation);
|
||||
GimpThresholdConfig *config = self->config;
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpThresholdConfig *config = GIMP_THRESHOLD_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
glong sample;
|
||||
|
||||
if (! config)
|
||||
return FALSE;
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#define __GIMP_OPERATION_THRESHOLD_H__
|
||||
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_THRESHOLD (gimp_operation_threshold_get_type ())
|
||||
|
@ -39,14 +38,12 @@ typedef struct _GimpOperationThresholdClass GimpOperationThresholdClass;
|
|||
|
||||
struct _GimpOperationThreshold
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpThresholdConfig *config;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationThresholdClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue