diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 4847cc4c0e..b0e5eb468b 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -25,7 +25,6 @@
#include "actions-types.h"
#include "core/gimp.h"
-#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpdrawable-invert.h"
#include "core/gimpdrawable-levels.h"
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index a879932b07..b98a0d097b 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -126,16 +126,12 @@ libappcore_a_sources = \
gimpdrawable-bucket-fill.h \
gimpdrawable-color-balance.c \
gimpdrawable-color-balance.h \
- gimpdrawable-colorize.c \
- gimpdrawable-colorize.h \
gimpdrawable-combine.c \
gimpdrawable-combine.h \
gimpdrawable-convert.c \
gimpdrawable-convert.h \
gimpdrawable-curves.c \
gimpdrawable-curves.h \
- gimpdrawable-desaturate.c \
- gimpdrawable-desaturate.h \
gimpdrawable-equalize.c \
gimpdrawable-equalize.h \
gimpdrawable-foreground-extract.c \
@@ -152,8 +148,6 @@ libappcore_a_sources = \
gimpdrawable-offset.h \
gimpdrawable-operation.c \
gimpdrawable-operation.h \
- gimpdrawable-posterize.c \
- gimpdrawable-posterize.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpdrawable-private.h \
@@ -163,8 +157,6 @@ libappcore_a_sources = \
gimpdrawable-shadow.h \
gimpdrawable-stroke.c \
gimpdrawable-stroke.h \
- gimpdrawable-threshold.c \
- gimpdrawable-threshold.h \
gimpdrawable-transform.c \
gimpdrawable-transform.h \
gimpdrawablemodundo.c \
diff --git a/app/core/gimpdrawable-colorize.c b/app/core/gimpdrawable-colorize.c
deleted file mode 100644
index 2b7a331c09..0000000000
--- a/app/core/gimpdrawable-colorize.c
+++ /dev/null
@@ -1,68 +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 "core-types.h"
-
-#include "gegl/gimpcolorizeconfig.h"
-
-#include "gimpdrawable.h"
-#include "gimpdrawable-operation.h"
-#include "gimpdrawable-colorize.h"
-
-#include "gimp-intl.h"
-
-
-/* public functions */
-
-void
-gimp_drawable_colorize (GimpDrawable *drawable,
- GimpProgress *progress,
- gdouble hue,
- gdouble saturation,
- gdouble lightness)
-{
- GeglNode *node;
- GObject *config;
-
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (! gimp_drawable_is_indexed (drawable));
- g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-
- node = g_object_new (GEGL_TYPE_NODE,
- "operation", "gimp:colorize",
- NULL);
-
- config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
- "hue", hue / 360.0,
- "saturation", saturation / 100.0,
- "lightness", lightness / 100.0,
- NULL);
-
- gegl_node_set (node,
- "config", config,
- NULL);
-
- g_object_unref (config);
-
- gimp_drawable_apply_operation (drawable, progress, C_("undo-type", "Colorize"),
- node, TRUE);
- g_object_unref (node);
-}
diff --git a/app/core/gimpdrawable-colorize.h b/app/core/gimpdrawable-colorize.h
deleted file mode 100644
index 2c98da3cee..0000000000
--- a/app/core/gimpdrawable-colorize.h
+++ /dev/null
@@ -1,29 +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 __GIMP_DRAWABLE_COLORIZE_H__
-#define __GIMP_DRAWABLE_COLORIZE_H__
-
-
-void gimp_drawable_colorize (GimpDrawable *drawable,
- GimpProgress *progress,
- gdouble hue,
- gdouble saturation,
- gdouble lightness);
-
-
-#endif /* __GIMP_DRAWABLE_COLORIZE_H__ */
diff --git a/app/core/gimpdrawable-desaturate.c b/app/core/gimpdrawable-desaturate.c
deleted file mode 100644
index 8578e9e72c..0000000000
--- a/app/core/gimpdrawable-desaturate.c
+++ /dev/null
@@ -1,64 +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 "core-types.h"
-
-#include "gegl/gimpdesaturateconfig.h"
-
-#include "gimpdrawable.h"
-#include "gimpdrawable-desaturate.h"
-#include "gimpdrawable-operation.h"
-#include "gimpprogress.h"
-
-#include "gimp-intl.h"
-
-
-void
-gimp_drawable_desaturate (GimpDrawable *drawable,
- GimpProgress *progress,
- GimpDesaturateMode mode)
-{
- GeglNode *node;
- 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)));
-
- node = g_object_new (GEGL_TYPE_NODE,
- "operation", "gimp:desaturate",
- NULL);
-
- config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
- "mode", mode,
- NULL);
-
- gegl_node_set (node,
- "config", config,
- NULL);
-
- g_object_unref (config);
-
- gimp_drawable_apply_operation (drawable, progress, _("Desaturate"),
- node, TRUE);
- g_object_unref (node);
-}
diff --git a/app/core/gimpdrawable-desaturate.h b/app/core/gimpdrawable-desaturate.h
deleted file mode 100644
index 7bd905601c..0000000000
--- a/app/core/gimpdrawable-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 __GIMP_DRAWABLE_DESATURATE_H__
-#define __GIMP_DRAWABLE_DESATURATE_H__
-
-
-void gimp_drawable_desaturate (GimpDrawable *drawable,
- GimpProgress *progress,
- GimpDesaturateMode mode);
-
-
-#endif /* __GIMP_DRAWABLE_DESATURATE_H__ */
diff --git a/app/core/gimpdrawable-operation.c b/app/core/gimpdrawable-operation.c
index a186c5a61e..1d14bb5ffb 100644
--- a/app/core/gimpdrawable-operation.c
+++ b/app/core/gimpdrawable-operation.c
@@ -33,6 +33,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-shadow.h"
+#include "gimpimagemapconfig.h"
#include "gimpprogress.h"
@@ -86,6 +87,37 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
gimp_progress_end (progress);
}
+void
+gimp_drawable_apply_operation_with_config (GimpDrawable *drawable,
+ GimpProgress *progress,
+ const gchar *undo_desc,
+ const gchar *operation_type,
+ GObject *config,
+ gboolean linear)
+{
+ GeglNode *node;
+
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
+ g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
+ g_return_if_fail (undo_desc != NULL);
+ g_return_if_fail (operation_type != NULL);
+ g_return_if_fail (GIMP_IS_IMAGE_MAP_CONFIG (config));
+
+ node = g_object_new (GEGL_TYPE_NODE,
+ "operation", operation_type,
+ NULL);
+
+ gegl_node_set (node,
+ "config", config,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress, undo_desc,
+ node, TRUE);
+
+ g_object_unref (node);
+}
+
void
gimp_drawable_apply_operation_to_tiles (GimpDrawable *drawable,
GimpProgress *progress,
diff --git a/app/core/gimpdrawable-operation.h b/app/core/gimpdrawable-operation.h
index 798680b393..8997c314c3 100644
--- a/app/core/gimpdrawable-operation.h
+++ b/app/core/gimpdrawable-operation.h
@@ -24,18 +24,24 @@
#define __GIMP_DRAWABLE_OPERATION_H__
-void gimp_drawable_apply_operation (GimpDrawable *drawable,
- GimpProgress *progress,
- const gchar *undo_desc,
- GeglNode *operation,
- gboolean linear);
+void gimp_drawable_apply_operation (GimpDrawable *drawable,
+ GimpProgress *progress,
+ const gchar *undo_desc,
+ GeglNode *operation,
+ gboolean linear);
+void gimp_drawable_apply_operation_with_config (GimpDrawable *drawable,
+ GimpProgress *progress,
+ const gchar *undo_desc,
+ const gchar *operation_type,
+ GObject *config,
+ gboolean linear);
-void gimp_drawable_apply_operation_to_tiles (GimpDrawable *drawable,
- GimpProgress *progress,
- const gchar *undo_desc,
- GeglNode *operation,
- gboolean linear,
- TileManager *new_tiles);
+void gimp_drawable_apply_operation_to_tiles (GimpDrawable *drawable,
+ GimpProgress *progress,
+ const gchar *undo_desc,
+ GeglNode *operation,
+ gboolean linear,
+ TileManager *new_tiles);
#endif /* __GIMP_DRAWABLE_OPERATION_H__ */
diff --git a/app/core/gimpdrawable-posterize.c b/app/core/gimpdrawable-posterize.c
deleted file mode 100644
index 540ca48a7c..0000000000
--- a/app/core/gimpdrawable-posterize.c
+++ /dev/null
@@ -1,64 +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 "core-types.h"
-
-#include "gegl/gimpposterizeconfig.h"
-
-#include "gimpdrawable.h"
-#include "gimpdrawable-operation.h"
-#include "gimpdrawable-posterize.h"
-
-#include "gimp-intl.h"
-
-
-/* public functions */
-
-void
-gimp_drawable_posterize (GimpDrawable *drawable,
- GimpProgress *progress,
- gint levels)
-{
- GeglNode *node;
- GObject *config;
-
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (! gimp_drawable_is_indexed (drawable));
- g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-
- node = g_object_new (GEGL_TYPE_NODE,
- "operation", "gimp:posterize",
- NULL);
-
- config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG,
- "levels", levels,
- NULL);
-
- gegl_node_set (node,
- "config", config,
- NULL);
-
- g_object_unref (config);
-
- gimp_drawable_apply_operation (drawable, progress, _("Posterize"),
- node, TRUE);
- g_object_unref (node);
-}
diff --git a/app/core/gimpdrawable-posterize.h b/app/core/gimpdrawable-posterize.h
deleted file mode 100644
index 16a89ebae5..0000000000
--- a/app/core/gimpdrawable-posterize.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 __GIMP_DRAWABLE_POSTERIZE_H__
-#define __GIMP_DRAWABLE_POSTERIZE_H__
-
-
-void gimp_drawable_posterize (GimpDrawable *drawable,
- GimpProgress *progress,
- gint levels);
-
-
-#endif /* __GIMP_DRAWABLE_POSTERIZE_H__ */
diff --git a/app/core/gimpdrawable-threshold.c b/app/core/gimpdrawable-threshold.c
deleted file mode 100644
index 2f093b4017..0000000000
--- a/app/core/gimpdrawable-threshold.c
+++ /dev/null
@@ -1,66 +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 "core-types.h"
-
-#include "gegl/gimpthresholdconfig.h"
-
-#include "gimpdrawable.h"
-#include "gimpdrawable-operation.h"
-#include "gimpdrawable-threshold.h"
-
-#include "gimp-intl.h"
-
-
-/* public functions */
-
-void
-gimp_drawable_threshold (GimpDrawable *drawable,
- GimpProgress *progress,
- gint low,
- gint high)
-{
- GeglNode *node;
- GObject *config;
-
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (! gimp_drawable_is_indexed (drawable));
- g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-
- node = g_object_new (GEGL_TYPE_NODE,
- "operation", "gimp:threshold",
- NULL);
-
- config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
- "low", low / 255.0,
- "high", high / 255.0,
- NULL);
-
- gegl_node_set (node,
- "config", config,
- NULL);
-
- g_object_unref (config);
-
- gimp_drawable_apply_operation (drawable, progress, _("Threshold"),
- node, TRUE);
- g_object_unref (node);
-}
diff --git a/app/core/gimpdrawable-threshold.h b/app/core/gimpdrawable-threshold.h
deleted file mode 100644
index 61bd1473d9..0000000000
--- a/app/core/gimpdrawable-threshold.h
+++ /dev/null
@@ -1,28 +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 __GIMP_DRAWABLE_THRESHOLD_H__
-#define __GIMP_DRAWABLE_THRESHOLD_H__
-
-
-void gimp_drawable_threshold (GimpDrawable *drawable,
- GimpProgress *progress,
- gint low,
- gint high);
-
-
-#endif /* __GIMP_DRAWABLE_THRESHOLD_H__ */
diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c
index 059b973e57..f34c638513 100644
--- a/app/pdb/color-cmds.c
+++ b/app/pdb/color-cmds.c
@@ -26,18 +26,19 @@
#include "base/gimphistogram.h"
#include "core/gimpdrawable-brightness-contrast.h"
#include "core/gimpdrawable-color-balance.h"
-#include "core/gimpdrawable-colorize.h"
#include "core/gimpdrawable-curves.h"
-#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpdrawable-hue-saturation.h"
#include "core/gimpdrawable-invert.h"
#include "core/gimpdrawable-levels.h"
-#include "core/gimpdrawable-posterize.h"
-#include "core/gimpdrawable-threshold.h"
+#include "core/gimpdrawable-operation.h"
#include "core/gimpdrawable.h"
#include "core/gimpparamspecs.h"
+#include "gegl/gimpcolorizeconfig.h"
+#include "gegl/gimpdesaturateconfig.h"
+#include "gegl/gimpposterizeconfig.h"
+#include "gegl/gimpthresholdconfig.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
@@ -201,13 +202,23 @@ posterize_invoker (GimpProcedure *procedure,
if (success)
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- gimp_drawable_is_indexed (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_indexed (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG,
+ "levels", levels,
+ NULL);
- if (success)
- gimp_drawable_posterize (drawable, progress, levels);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Posterize"),
+ "gimp:posterize",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -229,13 +240,23 @@ desaturate_invoker (GimpProcedure *procedure,
if (success)
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", GIMP_DESATURATE_LIGHTNESS,
+ NULL);
- if (success)
- gimp_drawable_desaturate (drawable, progress, GIMP_DESATURATE_LIGHTNESS);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -259,13 +280,23 @@ desaturate_full_invoker (GimpProcedure *procedure,
if (success)
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", desaturate_mode,
+ NULL);
- if (success)
- gimp_drawable_desaturate (drawable, progress, desaturate_mode);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -470,14 +501,25 @@ colorize_invoker (GimpProcedure *procedure,
if (success)
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
- if (success)
- gimp_drawable_colorize (drawable, progress,
- hue, saturation, lightness);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ C_("undo-type", "Colorize"),
+ "gimp:colorize",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
@@ -613,15 +655,24 @@ threshold_invoker (GimpProcedure *procedure,
if (success)
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- gimp_drawable_is_indexed (drawable) ||
- (low_threshold > high_threshold))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_indexed (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
+ "low", low_threshold / 255.0,
+ "high", high_threshold / 255.0,
+ NULL);
- if (success)
- gimp_drawable_threshold (drawable, progress,
- low_threshold, high_threshold);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Threshold"),
+ "gimp:threshold",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb
index 6fbba8b057..39666dddac 100644
--- a/tools/pdbgen/pdb/color.pdb
+++ b/tools/pdbgen/pdb/color.pdb
@@ -192,16 +192,26 @@ HELP
);
%invoke = (
- headers => [ qw("core/gimpdrawable-posterize.h") ],
+ headers => [ qw("gegl/gimpposterizeconfig.h") ],
code => <<'CODE'
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- gimp_drawable_is_indexed (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_indexed (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG,
+ "levels", levels,
+ NULL);
- if (success)
- gimp_drawable_posterize (drawable, progress, levels);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Posterize"),
+ "gimp:posterize",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
CODE
);
@@ -223,16 +233,26 @@ HELP
);
%invoke = (
- headers => [ qw("core/gimpdrawable-desaturate.h") ],
+ headers => [ qw("gegl/gimpdesaturateconfig.h") ],
code => <<'CODE'
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", GIMP_DESATURATE_LIGHTNESS,
+ NULL);
- if (success)
- gimp_drawable_desaturate (drawable, progress, GIMP_DESATURATE_LIGHTNESS);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
CODE
);
@@ -261,16 +281,26 @@ HELP
);
%invoke = (
- headers => [ qw("core/gimpdrawable-desaturate.h") ],
+ headers => [ qw("gegl/gimpdesaturateconfig.h") ],
code => <<'CODE'
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", desaturate_mode,
+ NULL);
- if (success)
- gimp_drawable_desaturate (drawable, progress, desaturate_mode);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
CODE
);
@@ -514,17 +544,28 @@ HELP
);
%invoke = (
- headers => [ qw("core/gimpdrawable-colorize.h") ],
+ headers => [ qw("gegl/gimpcolorizeconfig.h") ],
code => <<'CODE'
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- ! gimp_drawable_is_rgb (drawable))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
- if (success)
- gimp_drawable_colorize (drawable, progress,
- hue, saturation, lightness);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ C_("undo-type", "Colorize"),
+ "gimp:colorize",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
CODE
);
@@ -680,18 +721,27 @@ HELP
);
%invoke = (
- headers => [ qw("core/gimpdrawable-threshold.h") ],
+ headers => [ qw("gegl/gimpthresholdconfig.h") ],
code => <<'CODE'
{
- if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
- ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
- gimp_drawable_is_indexed (drawable) ||
- (low_threshold > high_threshold))
- success = FALSE;
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+ gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
+ ! gimp_drawable_is_indexed (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
+ "low", low_threshold / 255.0,
+ "high", high_threshold / 255.0,
+ NULL);
- if (success)
- gimp_drawable_threshold (drawable, progress,
- low_threshold, high_threshold);
+ gimp_drawable_apply_operation_with_config (drawable, progress,
+ _("Threshold"),
+ "gimp:threshold",
+ config, TRUE);
+
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
}
CODE
);
@@ -699,6 +749,7 @@ CODE
@headers = qw("core/gimpdrawable.h"
+ "core/gimpdrawable-operation.h"
"gimppdb-utils.h"
"gimp-intl.h");