diff --git a/app/base/Makefile.am b/app/base/Makefile.am
index 164aee1c37..f1dbb7d8a6 100644
--- a/app/base/Makefile.am
+++ b/app/base/Makefile.am
@@ -32,8 +32,6 @@ libappbase_a_SOURCES = \
cpercep.h \
curves.c \
curves.h \
- desaturate.c \
- desaturate.h \
gimphistogram.c \
gimphistogram.h \
gimplut.c \
diff --git a/app/base/desaturate.c b/app/base/desaturate.c
deleted file mode 100644
index 0468a137d7..0000000000
--- a/app/base/desaturate.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* GIMP - The GNU Image Manipulation Program
- * Copyright (C) 1995 Spencer Kimball and Peter Mattis
- *
- * 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 3 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, see .
- */
-
-#include "config.h"
-
-#include
-#include
-
-#include "libgimpcolor/gimpcolor.h"
-
-#include "base-types.h"
-
-#include "desaturate.h"
-#include "pixel-region.h"
-
-
-static void desaturate_region_lightness (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha);
-static void desaturate_region_luminosity (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha);
-static void desaturate_region_average (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha);
-
-
-void
-desaturate_region (GimpDesaturateMode *mode,
- PixelRegion *srcPR,
- PixelRegion *destPR)
-{
- g_return_if_fail (mode != NULL);
- g_return_if_fail (srcPR->bytes == destPR->bytes);
- g_return_if_fail (srcPR->bytes == 3 || srcPR->bytes == 4);
-
- switch (*mode)
- {
- case GIMP_DESATURATE_LIGHTNESS:
- desaturate_region_lightness (srcPR, destPR,
- pixel_region_has_alpha (srcPR));
- break;
-
- case GIMP_DESATURATE_LUMINOSITY:
- desaturate_region_luminosity (srcPR, destPR,
- pixel_region_has_alpha (srcPR));
- break;
-
- case GIMP_DESATURATE_AVERAGE:
- desaturate_region_average (srcPR, destPR,
- pixel_region_has_alpha (srcPR));
- break;
- }
-}
-
-static void
-desaturate_region_lightness (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha)
-{
- const guchar *src = srcPR->data;
- guchar *dest = destPR->data;
- gint h = srcPR->h;
-
- while (h--)
- {
- const guchar *s = src;
- guchar *d = dest;
- gint j;
-
- for (j = 0; j < srcPR->w; j++)
- {
- gint min, max;
- gint lightness;
-
- max = MAX (s[RED], s[GREEN]);
- max = MAX (max, s[BLUE]);
- min = MIN (s[RED], s[GREEN]);
- min = MIN (min, s[BLUE]);
-
- lightness = (max + min) / 2;
-
- d[RED] = lightness;
- d[GREEN] = lightness;
- d[BLUE] = lightness;
-
- if (has_alpha)
- d[ALPHA] = s[ALPHA];
-
- d += destPR->bytes;
- s += srcPR->bytes;
- }
-
- src += srcPR->rowstride;
- dest += destPR->rowstride;
- }
-}
-
-static void
-desaturate_region_luminosity (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha)
-{
- const guchar *src = srcPR->data;
- guchar *dest = destPR->data;
- gint h = srcPR->h;
-
- while (h--)
- {
- const guchar *s = src;
- guchar *d = dest;
- gint j;
-
- for (j = 0; j < srcPR->w; j++)
- {
- gint luminosity = GIMP_RGB_LUMINANCE (s[RED],
- s[GREEN],
- s[BLUE]) + 0.5;
-
- d[RED] = luminosity;
- d[GREEN] = luminosity;
- d[BLUE] = luminosity;
-
- if (has_alpha)
- d[ALPHA] = s[ALPHA];
-
- d += destPR->bytes;
- s += srcPR->bytes;
- }
-
- src += srcPR->rowstride;
- dest += destPR->rowstride;
- }
-}
-
-static void
-desaturate_region_average (PixelRegion *srcPR,
- PixelRegion *destPR,
- const gboolean has_alpha)
-{
- const guchar *src = srcPR->data;
- guchar *dest = destPR->data;
- gint h = srcPR->h;
-
- while (h--)
- {
- const guchar *s = src;
- guchar *d = dest;
- gint j;
-
- for (j = 0; j < srcPR->w; j++)
- {
- gint average = (s[RED] + s[GREEN] + s[BLUE] + 1) / 3;
-
- d[RED] = average;
- d[GREEN] = average;
- d[BLUE] = average;
-
- if (has_alpha)
- d[ALPHA] = s[ALPHA];
-
- d += destPR->bytes;
- s += srcPR->bytes;
- }
-
- src += srcPR->rowstride;
- dest += destPR->rowstride;
- }
-}
diff --git a/app/base/desaturate.h b/app/base/desaturate.h
deleted file mode 100644
index d0faee8e84..0000000000
--- a/app/base/desaturate.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* GIMP - The GNU Image Manipulation Program
- * Copyright (C) 1995 Spencer Kimball and Peter Mattis
- *
- * 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 3 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, see .
- */
-
-#ifndef __DESATURATE_H__
-#define __DESATURATE_H__
-
-
-void desaturate_region (GimpDesaturateMode *mode,
- PixelRegion *srcPR,
- PixelRegion *destPR);
-
-
-#endif /* __DESATURATE_H__ */
diff --git a/app/core/gimpdrawable-desaturate.c b/app/core/gimpdrawable-desaturate.c
index cdb3651edb..4e03ef3e85 100644
--- a/app/core/gimpdrawable-desaturate.c
+++ b/app/core/gimpdrawable-desaturate.c
@@ -21,18 +21,11 @@
#include "core-types.h"
-#include "base/desaturate.h"
-
#include "gegl/gimpdesaturateconfig.h"
-/* temp */
-#include "gimp.h"
-#include "gimpimage.h"
-
#include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-operation.h"
-#include "gimpdrawable-process.h"
#include "gimpprogress.h"
#include "gimp-intl.h"
@@ -43,37 +36,29 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
GimpProgress *progress,
GimpDesaturateMode mode)
{
+ GeglNode *desaturate;
+ GObject *config;
+
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_drawable_is_rgb (drawable));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
- if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp))
- {
- GeglNode *desaturate;
- GObject *config;
-
- desaturate = g_object_new (GEGL_TYPE_NODE,
- "operation", "gimp:desaturate",
- NULL);
-
- config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
- "mode", mode,
+ desaturate = g_object_new (GEGL_TYPE_NODE,
+ "operation", "gimp:desaturate",
NULL);
- gegl_node_set (desaturate,
- "config", config,
- NULL);
+ config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", mode,
+ NULL);
- g_object_unref (config);
+ gegl_node_set (desaturate,
+ "config", config,
+ NULL);
- gimp_drawable_apply_operation (drawable, progress, _("Desaturate"),
- desaturate, TRUE);
- g_object_unref (desaturate);
- }
- else
- {
- gimp_drawable_process (drawable, progress, _("Desaturate"),
- (PixelProcessorFunc) desaturate_region, &mode);
- }
+ g_object_unref (config);
+
+ gimp_drawable_apply_operation (drawable, progress, _("Desaturate"),
+ desaturate, TRUE);
+ g_object_unref (desaturate);
}
diff --git a/app/tools/gimpdesaturatetool.c b/app/tools/gimpdesaturatetool.c
index 9c829b049c..dc23e0d7eb 100644
--- a/app/tools/gimpdesaturatetool.c
+++ b/app/tools/gimpdesaturatetool.c
@@ -26,8 +26,6 @@
#include "tools-types.h"
-#include "base/desaturate.h"
-
#include "gegl/gimpdesaturateconfig.h"
#include "core/gimpdrawable.h"
@@ -100,10 +98,6 @@ gimp_desaturate_tool_class_init (GimpDesaturateToolClass *klass)
static void
gimp_desaturate_tool_init (GimpDesaturateTool *desaturate_tool)
{
- GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (desaturate_tool);
-
- im_tool->apply_func = (GimpImageMapApplyFunc) desaturate_region;
- im_tool->apply_data = &desaturate_tool->mode;
}
static gboolean
@@ -169,15 +163,12 @@ gimp_desaturate_tool_get_operation (GimpImageMapTool *image_map_tool,
static void
gimp_desaturate_tool_map (GimpImageMapTool *image_map_tool)
{
- GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
-
- desaturate_tool->mode = desaturate_tool->config->mode;
}
-/**********************/
+/***********************/
/* Desaturate dialog */
-/**********************/
+/***********************/
static void
gimp_desaturate_tool_dialog (GimpImageMapTool *image_map_tool)
diff --git a/app/tools/gimpdesaturatetool.h b/app/tools/gimpdesaturatetool.h
index 00658abe3b..41ab6a143a 100644
--- a/app/tools/gimpdesaturatetool.h
+++ b/app/tools/gimpdesaturatetool.h
@@ -38,7 +38,6 @@ struct _GimpDesaturateTool
GimpImageMapTool parent_instance;
GimpDesaturateConfig *config;
- GimpDesaturateMode mode; /* only for legacy mode */
/* dialog */
GtkWidget *button;