mirror of https://github.com/GNOME/gimp.git
app: remove the pointless core wrappers for the below simplified color stuff
Instead, provide gimp_drawable_apply_operation_with_config() and call that from the PDB wrappers directly.
This commit is contained in:
parent
8684b87f04
commit
0623c7f365
|
@ -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"
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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__ */
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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__ */
|
|
@ -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,
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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__ */
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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__ */
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue