From 7b009c69000b6ce3409f6f6f9cda161d0c6f1a34 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 16 Jan 2016 21:41:00 +0100 Subject: [PATCH] app: turn the posterize tool into an ordinary GEGL filter which means replacing the whole thing by a few lines. --- app/actions/filters-actions.c | 8 +- app/operations/Makefile.am | 2 - app/operations/gimpoperationposterize.c | 108 ++++++++++++++++------ app/operations/gimpoperationposterize.h | 2 + app/operations/gimpposterizeconfig.c | 117 ------------------------ app/operations/gimpposterizeconfig.h | 54 ----------- app/pdb/color-cmds.c | 18 ++-- app/pdb/drawable-color-cmds.c | 18 ++-- app/tools/Makefile.am | 2 - app/tools/gimp-tools.c | 2 - app/tools/gimpposterizetool.c | 115 ----------------------- app/tools/gimpposterizetool.h | 53 ----------- menus/image-menu.xml.in | 2 +- po/POTFILES.in | 2 +- tools/pdbgen/pdb/color.pdb | 18 ++-- tools/pdbgen/pdb/drawable_color.pdb | 18 ++-- 16 files changed, 126 insertions(+), 413 deletions(-) delete mode 100644 app/operations/gimpposterizeconfig.c delete mode 100644 app/operations/gimpposterizeconfig.h delete mode 100644 app/tools/gimpposterizetool.c delete mode 100644 app/tools/gimpposterizetool.h diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c index 8c8de4416f..e9833b229d 100644 --- a/app/actions/filters-actions.c +++ b/app/actions/filters-actions.c @@ -402,6 +402,11 @@ static const GimpStringActionEntry filters_actions[] = "gegl:polar-coordinates", NULL /* FIXME GIMP_HELP_FILTER_POLAR_COORDINATES */ }, + { "filters-posterize", GIMP_STOCK_TOOL_POSTERIZE, + NC_("filters-action", "_Posterize..."), NULL, NULL, + "gimp:posterize", + GIMP_HELP_TOOL_POSTERIZE }, + { "filters-red-eye-removal", GIMP_STOCK_GEGL, NC_("filters-action", "_Red Eye Removal..."), NULL, NULL, "gegl:red-eye-removal", @@ -415,7 +420,7 @@ static const GimpStringActionEntry filters_actions[] = { "filters-semi-flatten", GIMP_STOCK_GEGL, NC_("filters-action", "_Semi-Flatten..."), NULL, NULL, "gimp:semi-flatten", - NULL /* FIXME GIMP_HELP_FILTER_POLAR_COORDINATES */ }, + NULL /* FIXME GIMP_HELP_FILTER_SEMI_FLATTEN */ }, { "filters-sepia", GIMP_STOCK_GEGL, NC_("filters-action", "_Sepia..."), NULL, NULL, @@ -689,6 +694,7 @@ filters_actions_update (GimpActionGroup *group, SET_SENSITIVE ("filters-pixelize", writable); SET_SENSITIVE ("filters-plasma", writable); SET_SENSITIVE ("filters-polar-coordinates", writable); + SET_SENSITIVE ("filters-posterize", writable); SET_SENSITIVE ("filters-red-eye-removal", writable && !gray); SET_SENSITIVE ("filters-ripple", writable); SET_SENSITIVE ("filters-semi-flatten", writable && alpha); diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am index 79cd653178..1adc703dc2 100644 --- a/app/operations/Makefile.am +++ b/app/operations/Makefile.am @@ -39,8 +39,6 @@ libappoperations_generic_a_sources = \ gimphuesaturationconfig.h \ gimplevelsconfig.c \ gimplevelsconfig.h \ - gimpposterizeconfig.c \ - gimpposterizeconfig.h \ gimpthresholdconfig.c \ gimpthresholdconfig.h \ \ diff --git a/app/operations/gimpoperationposterize.c b/app/operations/gimpoperationposterize.c index 9b7397e193..891f1b8df3 100644 --- a/app/operations/gimpoperationposterize.c +++ b/app/operations/gimpoperationposterize.c @@ -24,20 +24,38 @@ #include #include +#include "libgimpconfig/gimpconfig.h" #include "libgimpmath/gimpmath.h" #include "operations-types.h" #include "gimpoperationposterize.h" -#include "gimpposterizeconfig.h" + +#include "gimp-intl.h" -static gboolean gimp_operation_posterize_process (GeglOperation *operation, - void *in_buf, - void *out_buf, - glong samples, - const GeglRectangle *roi, - gint level); +enum +{ + PROP_0, + PROP_LEVELS +}; + + +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, + const GeglRectangle *roi, + gint level); G_DEFINE_TYPE (GimpOperationPosterize, gimp_operation_posterize, @@ -53,25 +71,21 @@ gimp_operation_posterize_class_init (GimpOperationPosterizeClass *klass) GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass); GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass); - object_class->set_property = gimp_operation_point_filter_set_property; - object_class->get_property = gimp_operation_point_filter_get_property; + object_class->set_property = gimp_operation_posterize_set_property; + object_class->get_property = gimp_operation_posterize_get_property; + + point_class->process = gimp_operation_posterize_process; gegl_operation_class_set_keys (operation_class, "name", "gimp:posterize", "categories", "color", - "description", "GIMP Posterize operation", + "description", _("Reduce to a limited set of colors"), NULL); - point_class->process = gimp_operation_posterize_process; - - g_object_class_install_property (object_class, - GIMP_OPERATION_POINT_FILTER_PROP_CONFIG, - g_param_spec_object ("config", - "Config", - "The config object", - GIMP_TYPE_POSTERIZE_CONFIG, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT)); + GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LEVELS, + "levels", + _("Posterize levels"), + 2, 256, 3, 0); } static void @@ -79,6 +93,46 @@ gimp_operation_posterize_init (GimpOperationPosterize *self) { } +static void +gimp_operation_posterize_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpOperationPosterize *posterize = GIMP_OPERATION_POSTERIZE (object); + + switch (property_id) + { + case PROP_LEVELS: + g_value_set_int (value, posterize->levels); + 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 *posterize = GIMP_OPERATION_POSTERIZE (object); + + switch (property_id) + { + case PROP_LEVELS: + posterize->levels = g_value_get_int (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, @@ -87,16 +141,12 @@ gimp_operation_posterize_process (GeglOperation *operation, const GeglRectangle *roi, gint level) { - GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation); - GimpPosterizeConfig *config = GIMP_POSTERIZE_CONFIG (point->config); - gfloat *src = in_buf; - gfloat *dest = out_buf; - gfloat levels; + GimpOperationPosterize *posterize = GIMP_OPERATION_POSTERIZE (operation); + gfloat *src = in_buf; + gfloat *dest = out_buf; + gfloat levels; - if (! config) - return FALSE; - - levels = config->levels - 1.0; + levels = posterize->levels - 1.0; while (samples--) { diff --git a/app/operations/gimpoperationposterize.h b/app/operations/gimpoperationposterize.h index b023a9d9de..0158d6eced 100644 --- a/app/operations/gimpoperationposterize.h +++ b/app/operations/gimpoperationposterize.h @@ -39,6 +39,8 @@ typedef struct _GimpOperationPosterizeClass GimpOperationPosterizeClass; struct _GimpOperationPosterize { GimpOperationPointFilter parent_instance; + + gint levels; }; struct _GimpOperationPosterizeClass diff --git a/app/operations/gimpposterizeconfig.c b/app/operations/gimpposterizeconfig.c deleted file mode 100644 index c137946865..0000000000 --- a/app/operations/gimpposterizeconfig.c +++ /dev/null @@ -1,117 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpposterizeconfig.c - * Copyright (C) 2007 Michael Natterer - * - * 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 "libgimpconfig/gimpconfig.h" - -#include "operations-types.h" - -#include "gimpposterizeconfig.h" - - -enum -{ - PROP_0, - PROP_LEVELS -}; - - -static void gimp_posterize_config_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); -static void gimp_posterize_config_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - - -G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config, - GIMP_TYPE_SETTINGS, - G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL)) - -#define parent_class gimp_posterize_config_parent_class - - -static void -gimp_posterize_config_class_init (GimpPosterizeConfigClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass); - - object_class->set_property = gimp_posterize_config_set_property; - object_class->get_property = gimp_posterize_config_get_property; - - viewable_class->default_icon_name = "gimp-tool-posterize"; - - GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LEVELS, - "levels", - "Posterize levels", - 2, 256, 3, 0); -} - -static void -gimp_posterize_config_init (GimpPosterizeConfig *self) -{ -} - -static void -gimp_posterize_config_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GimpPosterizeConfig *self = GIMP_POSTERIZE_CONFIG (object); - - switch (property_id) - { - case PROP_LEVELS: - g_value_set_int (value, self->levels); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gimp_posterize_config_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GimpPosterizeConfig *self = GIMP_POSTERIZE_CONFIG (object); - - switch (property_id) - { - case PROP_LEVELS: - self->levels = g_value_get_int (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} diff --git a/app/operations/gimpposterizeconfig.h b/app/operations/gimpposterizeconfig.h deleted file mode 100644 index 4d813d3c45..0000000000 --- a/app/operations/gimpposterizeconfig.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpposterizeconfig.h - * Copyright (C) 2007 Michael Natterer - * - * 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_POSTERIZE_CONFIG_H__ -#define __GIMP_POSTERIZE_CONFIG_H__ - - -#include "core/gimpsettings.h" - - -#define GIMP_TYPE_POSTERIZE_CONFIG (gimp_posterize_config_get_type ()) -#define GIMP_POSTERIZE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfig)) -#define GIMP_POSTERIZE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfigClass)) -#define GIMP_IS_POSTERIZE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_POSTERIZE_CONFIG)) -#define GIMP_IS_POSTERIZE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_POSTERIZE_CONFIG)) -#define GIMP_POSTERIZE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfigClass)) - - -typedef struct _GimpPosterizeConfigClass GimpPosterizeConfigClass; - -struct _GimpPosterizeConfig -{ - GimpSettings parent_instance; - - gint levels; -}; - -struct _GimpPosterizeConfigClass -{ - GimpSettingsClass parent_class; -}; - - -GType gimp_posterize_config_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_POSTERIZE_CONFIG_H__ */ diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c index aa412db3bd..38e62a2aed 100644 --- a/app/pdb/color-cmds.c +++ b/app/pdb/color-cmds.c @@ -44,7 +44,6 @@ #include "operations/gimpdesaturateconfig.h" #include "operations/gimphuesaturationconfig.h" #include "operations/gimplevelsconfig.h" -#include "operations/gimpposterizeconfig.h" #include "operations/gimpthresholdconfig.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" @@ -238,15 +237,16 @@ posterize_invoker (GimpProcedure *procedure, GIMP_PDB_ITEM_CONTENT, error) && gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) { - GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, - "levels", levels, - NULL); + GeglNode *node = + gegl_node_new_child (NULL, + "operation", "gimp:posterize", + "levels", levels, + NULL); - gimp_drawable_apply_operation_by_name (drawable, progress, - _("Posterize"), - "gimp:posterize", - config); - g_object_unref (config); + gimp_drawable_apply_operation (drawable, progress, + C_("undo-type", "Posterize"), + node); + g_object_unref (node); } else success = FALSE; diff --git a/app/pdb/drawable-color-cmds.c b/app/pdb/drawable-color-cmds.c index d563bf432e..9e984b7940 100644 --- a/app/pdb/drawable-color-cmds.c +++ b/app/pdb/drawable-color-cmds.c @@ -44,7 +44,6 @@ #include "operations/gimpdesaturateconfig.h" #include "operations/gimphuesaturationconfig.h" #include "operations/gimplevelsconfig.h" -#include "operations/gimpposterizeconfig.h" #include "operations/gimpthresholdconfig.h" #include "plug-in/gimpplugin.h" #include "plug-in/gimppluginmanager.h" @@ -652,15 +651,16 @@ drawable_posterize_invoker (GimpProcedure *procedure, GIMP_PDB_ITEM_CONTENT, error) && gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) { - GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, - "levels", levels, - NULL); + GeglNode *node = + gegl_node_new_child (NULL, + "operation", "gimp:posterize", + "levels", levels, + NULL); - gimp_drawable_apply_operation_by_name (drawable, progress, - C_("undo-type", "Posterize"), - "gimp:posterize", - config); - g_object_unref (config); + gimp_drawable_apply_operation (drawable, progress, + C_("undo-type", "Posterize"), + node); + g_object_unref (node); } else success = FALSE; diff --git a/app/tools/Makefile.am b/app/tools/Makefile.am index 7a19126531..d80d723cbc 100644 --- a/app/tools/Makefile.am +++ b/app/tools/Makefile.am @@ -156,8 +156,6 @@ libapptools_a_sources = \ gimpperspectiveclonetool.h \ gimpperspectivetool.c \ gimpperspectivetool.h \ - gimpposterizetool.c \ - gimpposterizetool.h \ gimprectangleselecttool.c \ gimprectangleselecttool.h \ gimprectangleselectoptions.c \ diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c index 362ea00d7b..8d947e6ad4 100644 --- a/app/tools/gimp-tools.c +++ b/app/tools/gimp-tools.c @@ -77,7 +77,6 @@ #include "gimppenciltool.h" #include "gimpperspectiveclonetool.h" #include "gimpperspectivetool.h" -#include "gimpposterizetool.h" #include "gimpthresholdtool.h" #include "gimprectangleselecttool.h" #include "gimprotatetool.h" @@ -127,7 +126,6 @@ gimp_tools_init (Gimp *gimp) /* color tools */ gimp_operation_tool_register, gimp_gegl_tool_register, - gimp_posterize_tool_register, gimp_curves_tool_register, gimp_levels_tool_register, gimp_threshold_tool_register, diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c deleted file mode 100644 index ed8f2a99b7..0000000000 --- a/app/tools/gimpposterizetool.c +++ /dev/null @@ -1,115 +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 "libgimpwidgets/gimpwidgets.h" - -#include "tools-types.h" - -#include "operations/gimpposterizeconfig.h" - -#include "widgets/gimphelp-ids.h" -#include "widgets/gimppropwidgets.h" -#include "widgets/gimpspinscale.h" - -#include "gimpimagemapoptions.h" -#include "gimpposterizetool.h" - -#include "gimp-intl.h" - - -static GeglNode * gimp_posterize_tool_get_operation (GimpImageMapTool *im_tool, - GObject **config, - gchar **undo_desc); -static void gimp_posterize_tool_dialog (GimpImageMapTool *im_tool); - - -G_DEFINE_TYPE (GimpPosterizeTool, gimp_posterize_tool, - GIMP_TYPE_IMAGE_MAP_TOOL) - -#define parent_class gimp_posterize_tool_parent_class - - -void -gimp_posterize_tool_register (GimpToolRegisterCallback callback, - gpointer data) -{ - (* callback) (GIMP_TYPE_POSTERIZE_TOOL, - GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL, - 0, - "gimp-posterize-tool", - _("Posterize"), - _("Posterize Tool: Reduce to a limited set of colors"), - N_("_Posterize..."), NULL, - NULL, GIMP_HELP_TOOL_POSTERIZE, - GIMP_STOCK_TOOL_POSTERIZE, - data); -} - -static void -gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass) -{ - GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - - im_tool_class->dialog_desc = _("Posterize (Reduce Number of Colors)"); - - im_tool_class->get_operation = gimp_posterize_tool_get_operation; - im_tool_class->dialog = gimp_posterize_tool_dialog; -} - -static void -gimp_posterize_tool_init (GimpPosterizeTool *posterize_tool) -{ -} - -static GeglNode * -gimp_posterize_tool_get_operation (GimpImageMapTool *image_map_tool, - GObject **config, - gchar **undo_desc) -{ - *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, NULL); - - return gegl_node_new_child (NULL, - "operation", "gimp:posterize", - "config", *config, - NULL); -} - - -/**********************/ -/* Posterize dialog */ -/**********************/ - -static void -gimp_posterize_tool_dialog (GimpImageMapTool *image_map_tool) -{ - GtkWidget *main_vbox; - GtkWidget *scale; - - main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); - - scale = gimp_prop_spin_scale_new (image_map_tool->config, "levels", - _("Posterize _levels"), - 1.0, 10.0, 0); - gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.5); - gtk_box_pack_start (GTK_BOX (main_vbox), scale, FALSE, FALSE, 0); - gtk_widget_show (scale); -} diff --git a/app/tools/gimpposterizetool.h b/app/tools/gimpposterizetool.h deleted file mode 100644 index ac804a6a31..0000000000 --- a/app/tools/gimpposterizetool.h +++ /dev/null @@ -1,53 +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_POSTERIZE_TOOL_H__ -#define __GIMP_POSTERIZE_TOOL_H__ - - -#include "gimpimagemaptool.h" - - -#define GIMP_TYPE_POSTERIZE_TOOL (gimp_posterize_tool_get_type ()) -#define GIMP_POSTERIZE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_POSTERIZE_TOOL, GimpPosterizeTool)) -#define GIMP_POSTERIZE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_POSTERIZE_TOOL, GimpPosterizeToolClass)) -#define GIMP_IS_POSTERIZE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_POSTERIZE_TOOL)) -#define GIMP_IS_POSTERIZE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_POSTERIZE_TOOL)) -#define GIMP_POSTERIZE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_POSTERIZE_TOOL, GimpPosterizeToolClass)) - - -typedef struct _GimpPosterizeTool GimpPosterizeTool; -typedef struct _GimpPosterizeToolClass GimpPosterizeToolClass; - -struct _GimpPosterizeTool -{ - GimpImageMapTool parent_instance; -}; - -struct _GimpPosterizeToolClass -{ - GimpImageMapToolClass parent_class; -}; - - -void gimp_posterize_tool_register (GimpToolRegisterCallback callback, - gpointer data); - -GType gimp_posterize_tool_get_type (void) G_GNUC_CONST; - - -#endif /* __GIMP_POSTERIZE_TOOL_H__ */ diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in index 9a4e1b10a7..5a768bdaaa 100644 --- a/menus/image-menu.xml.in +++ b/menus/image-menu.xml.in @@ -532,7 +532,7 @@ - + diff --git a/po/POTFILES.in b/po/POTFILES.in index 9024cc5f76..286d3f09b6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -254,6 +254,7 @@ app/operations/gimphuesaturationconfig.c app/operations/gimplevelsconfig.c app/operations/gimpoperationcagecoefcalc.c app/operations/gimpoperationcagetransform.c +app/operations/gimpoperationposterize.c app/operations/gimpoperationsemiflatten.c app/operations/gimpoperationthresholdalpha.c app/operations/gimpthresholdconfig.c @@ -405,7 +406,6 @@ app/tools/gimppainttool.c app/tools/gimppenciltool.c app/tools/gimpperspectiveclonetool.c app/tools/gimpperspectivetool.c -app/tools/gimpposterizetool.c app/tools/gimprectangleoptions.c app/tools/gimprectangleselectoptions.c app/tools/gimprectangleselecttool.c diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb index fd17fc7a15..9a6a6ae33f 100644 --- a/tools/pdbgen/pdb/color.pdb +++ b/tools/pdbgen/pdb/color.pdb @@ -171,22 +171,22 @@ sub posterize { ); %invoke = ( - headers => [ qw("operations/gimpposterizeconfig.h") ], code => <<'CODE' { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, GIMP_PDB_ITEM_CONTENT, error) && gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) { - GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, - "levels", levels, - NULL); + GeglNode *node = + gegl_node_new_child (NULL, + "operation", "gimp:posterize", + "levels", levels, + NULL); - gimp_drawable_apply_operation_by_name (drawable, progress, - _("Posterize"), - "gimp:posterize", - config); - g_object_unref (config); + gimp_drawable_apply_operation (drawable, progress, + C_("undo-type", "Posterize"), + node); + g_object_unref (node); } else success = FALSE; diff --git a/tools/pdbgen/pdb/drawable_color.pdb b/tools/pdbgen/pdb/drawable_color.pdb index 0dd7bf9040..342f124fb1 100644 --- a/tools/pdbgen/pdb/drawable_color.pdb +++ b/tools/pdbgen/pdb/drawable_color.pdb @@ -710,22 +710,22 @@ HELP ); %invoke = ( - headers => [ qw("operations/gimpposterizeconfig.h") ], code => <<'CODE' { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, GIMP_PDB_ITEM_CONTENT, error) && gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) { - GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, - "levels", levels, - NULL); + GeglNode *node = + gegl_node_new_child (NULL, + "operation", "gimp:posterize", + "levels", levels, + NULL); - gimp_drawable_apply_operation_by_name (drawable, progress, - C_("undo-type", "Posterize"), - "gimp:posterize", - config); - g_object_unref (config); + gimp_drawable_apply_operation (drawable, progress, + C_("undo-type", "Posterize"), + node); + g_object_unref (node); } else success = FALSE;