[gimp] app,libgimp,pdb: add a "drawable_color" PDB group
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app,libgimp,pdb: add a "drawable_color" PDB group
- Date: Sun, 12 Jan 2014 22:13:09 +0000 (UTC)
commit b4462e9e193f7f76383f90d3298832d6beaa6597
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 12 22:11:15 2014 +0100
app,libgimp,pdb: add a "drawable_color" PDB group
Which contains all the API from the "color" group, but with a
gimp_drawable namespace and with support for high bit depths. The
group is actually a copy of "color" with cruft removed and some API
ported to using float instead of integer API.
Deprecated all "color" functions that already have a ported version in
"drawable_color".
This is unfinished WIP, some functions in "drawable_color" still have
the old API.
app/pdb/Makefile.am | 1 +
app/pdb/color-cmds.c | 224 ++-----
app/pdb/drawable-color-cmds.c | 1291 +++++++++++++++++++++++++++++++++++
app/pdb/internal-procs.c | 3 +-
app/pdb/internal-procs.h | 1 +
libgimp/Makefile.am | 2 +
libgimp/gimp.def | 15 +-
libgimp/gimp_pdb_headers.h | 1 +
libgimp/gimpcolor_pdb.c | 121 +---
libgimp/gimpcolor_pdb.h | 129 ++--
libgimp/gimpdrawablecolor_pdb.c | 675 ++++++++++++++++++
libgimp/gimpdrawablecolor_pdb.h | 94 +++
tools/pdbgen/Makefile.am | 1 +
tools/pdbgen/groups.pl | 1 +
tools/pdbgen/pdb/color.pdb | 176 +-----
tools/pdbgen/pdb/drawable_color.pdb | 815 ++++++++++++++++++++++
16 files changed, 3044 insertions(+), 506 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index fffe894..4976982 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -44,6 +44,7 @@ libappinternal_procs_a_SOURCES = \
convert-cmds.c \
display-cmds.c \
drawable-cmds.c \
+ drawable-color-cmds.c \
drawable-transform-cmds.c \
dynamics-cmds.c \
edit-cmds.c \
diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c
index 2aadfb2..af63da6 100644
--- a/app/pdb/color-cmds.c
+++ b/app/pdb/color-cmds.c
@@ -519,7 +519,7 @@ color_balance_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_COLORIZE_CONFIG,
+ GObject *config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG,
"range", transfer_mode,
"preserve-luminosity", preserve_lum,
NULL);
@@ -734,60 +734,6 @@ hue_saturation_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
-hue_saturation_overlap_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- gboolean success = TRUE;
- GimpDrawable *drawable;
- gint32 hue_range;
- gdouble hue_offset;
- gdouble lightness;
- gdouble saturation;
- gdouble overlap;
-
- drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
- hue_range = g_value_get_enum (gimp_value_array_index (args, 1));
- hue_offset = g_value_get_double (gimp_value_array_index (args, 2));
- lightness = g_value_get_double (gimp_value_array_index (args, 3));
- saturation = g_value_get_double (gimp_value_array_index (args, 4));
- overlap = g_value_get_double (gimp_value_array_index (args, 5));
-
- if (success)
- {
- 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_HUE_SATURATION_CONFIG,
- "range", hue_range,
- NULL);
-
- g_object_set (config,
- "hue", hue_offset / 180.0,
- "saturation", saturation / 100.0,
- "lightness", lightness / 100.0,
- "overlap", overlap / 100.0,
- NULL);
-
- gimp_drawable_apply_operation_by_name (drawable, progress,
- _("Hue-Saturation"),
- "gimp:hue-saturation",
- config);
- g_object_unref (config);
- }
- else
- success = FALSE;
- }
-
- return gimp_procedure_get_return_values (procedure, success,
- error ? *error : NULL);
-}
-
-static GimpValueArray *
threshold_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -842,12 +788,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-brightness-contrast");
gimp_procedure_set_static_strings (procedure,
"gimp-brightness-contrast",
- "Modify brightness/contrast in the specified drawable.",
- "This procedures allows the brightness and contrast of the specified
drawable to be modified. Both 'brightness' and 'contrast' parameters are defined between -127 and 127.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1997",
- NULL);
+ "Deprecated: Use 'gimp-drawable-brightness-contrast' instead.",
+ "Deprecated: Use 'gimp-drawable-brightness-contrast' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-brightness-contrast");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -877,12 +823,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-levels");
gimp_procedure_set_static_strings (procedure,
"gimp-levels",
- "Modifies intensity levels in the specified drawable.",
- "This tool allows intensity levels in the specified drawable to be
remapped according to a set of parameters. The low/high input levels specify an initial mapping from the
source intensities. The gamma value determines how intensities between the low and high input intensities are
interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more
high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels
constrain the final intensity mapping--that is, no final intensity will be lower than the low output level
and no final intensity will be higher than the high output level. This tool is only valid on RGB color and
grayscale images.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
+ "Deprecated: Use 'gimp-drawable-levels' instead.",
+ "Deprecated: Use 'gimp-drawable-levels' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-levels");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -937,12 +883,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-levels-auto");
gimp_procedure_set_static_strings (procedure,
"gimp-levels-auto",
- "Deprecated: Use 'gimp-levels-stretch' instead.",
- "Deprecated: Use 'gimp-levels-stretch' instead.",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
"",
"",
"",
- "gimp-levels-stretch");
+ "gimp-drawable-levels-stretch");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -960,12 +906,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-levels-stretch");
gimp_procedure_set_static_strings (procedure,
"gimp-levels-stretch",
- "Automatically modifies intensity levels in the specified drawable.",
- "This procedure allows intensity levels in the specified drawable to be
remapped according to a set of guessed parameters. It is equivalent to clicking the \"Auto\" button in the
Levels tool.",
- "Joao S.O. Bueno, Shawn Willden",
- "Joao S.O. Bueno, Shawn Willden",
- "2003",
- NULL);
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "Deprecated: Use 'gimp-drawable-levels-stretch' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-levels-stretch");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -983,12 +929,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-posterize");
gimp_procedure_set_static_strings (procedure,
"gimp-posterize",
- "Posterize the specified drawable.",
- "This procedures reduces the number of shades allows in each intensity
channel to the specified 'levels' parameter.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1997",
- NULL);
+ "Deprecated: Use 'gimp-drawable-posterize' instead.",
+ "Deprecated: Use 'gimp-drawable-posterize' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-posterize");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1012,12 +958,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-desaturate");
gimp_procedure_set_static_strings (procedure,
"gimp-desaturate",
- "Desaturate the contents of the specified drawable.",
- "This procedure desaturates the contents of the specified drawable.
This procedure only works on drawables of type RGB color.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-desaturate");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1035,12 +981,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-desaturate-full");
gimp_procedure_set_static_strings (procedure,
"gimp-desaturate-full",
- "Desaturate the contents of the specified drawable, with the specified
formula.",
- "This procedure desaturates the contents of the specified drawable,
with the specified formula. This procedure only works on drawables of type RGB color.",
- "Karine Delvare",
- "Karine Delvare",
- "2005",
- NULL);
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "Deprecated: Use 'gimp-drawable-desaturate' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-desaturate");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1065,12 +1011,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-equalize");
gimp_procedure_set_static_strings (procedure,
"gimp-equalize",
- "Equalize the contents of the specified drawable.",
- "This procedure equalizes the contents of the specified drawable. Each
intensity channel is equalized independently. The equalized intensity is given as inten' = (255 - inten). The
'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the
entire image based on the histogram of the selected area. If there is no selection, the entire image is
adjusted based on the histogram for the entire image.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
+ "Deprecated: Use 'gimp-drawable-equalize' instead.",
+ "Deprecated: Use 'gimp-drawable-equalize' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-equalize");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1253,12 +1199,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-colorize");
gimp_procedure_set_static_strings (procedure,
"gimp-colorize",
- "Render the drawable as a grayscale image seen through a colored
glass.",
- "Desaturates the drawable, then tints it with the specified color. This
tool is only valid on RGB color images. It will not operate on grayscale drawables.",
- "Sven Neumann <sven gimp org>",
- "Sven Neumann",
- "2004",
- NULL);
+ "Deprecated: Use 'gimp-drawable-colorize-hsl' instead.",
+ "Deprecated: Use 'gimp-drawable-colorize-hsl' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-colorize-hsl");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1372,60 +1318,12 @@ register_color_procs (GimpPDB *pdb)
"gimp-hue-saturation");
gimp_procedure_set_static_strings (procedure,
"gimp-hue-saturation",
- "Modify hue, lightness, and saturation in the specified drawable.",
- "This procedure allows the hue, lightness, and saturation in the
specified drawable to be modified. The 'hue-range' parameter provides the capability to limit range of
affected hues.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1997",
- NULL);
- gimp_procedure_add_argument (procedure,
- gimp_param_spec_drawable_id ("drawable",
- "drawable",
- "The drawable",
- pdb->gimp, FALSE,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_enum ("hue-range",
- "hue range",
- "Range of affected hues",
- GIMP_TYPE_HUE_RANGE,
- GIMP_ALL_HUES,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_double ("hue-offset",
- "hue offset",
- "Hue offset in degrees",
- -180, 180, -180,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_double ("lightness",
- "lightness",
- "Lightness modification",
- -100, 100, -100,
- GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_double ("saturation",
- "saturation",
- "Saturation modification",
- -100, 100, -100,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
- * gimp-hue-saturation-overlap
- */
- procedure = gimp_procedure_new (hue_saturation_overlap_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-hue-saturation-overlap");
- gimp_procedure_set_static_strings (procedure,
- "gimp-hue-saturation-overlap",
- "Modify hue, lightness, and saturation in the specified drawable.",
- "This procedure allows the hue, lightness, and saturation in the
specified drawable to be modified. The 'hue-range' parameter provides the capability to limit range of
affected hues. The 'overlap' parameter provides blending into neighboring hue channels when rendering.",
- "Jo\xc3\xa3o S. O. Bueno",
- "Jo\xc3\xa3o S. O. Bueno",
- "2014",
- NULL);
+ "Deprecated: Use 'gimp-drawable-hue-saturation' instead.",
+ "Deprecated: Use 'gimp-drawable-hue-saturation' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-hue-saturation");
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
@@ -1457,12 +1355,6 @@ register_color_procs (GimpPDB *pdb)
"Saturation modification",
-100, 100, -100,
GIMP_PARAM_READWRITE));
- gimp_procedure_add_argument (procedure,
- g_param_spec_double ("overlap",
- "overlap",
- "Overlap other hue channels",
- 0, 100, 0,
- GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
diff --git a/app/pdb/drawable-color-cmds.c b/app/pdb/drawable-color-cmds.c
new file mode 100644
index 0000000..0feb8f9
--- /dev/null
+++ b/app/pdb/drawable-color-cmds.c
@@ -0,0 +1,1291 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 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/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpdrawable-equalize.h"
+#include "core/gimpdrawable-histogram.h"
+#include "core/gimpdrawable-levels.h"
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable.h"
+#include "core/gimphistogram.h"
+#include "core/gimpparamspecs.h"
+#include "operations/gimpbrightnesscontrastconfig.h"
+#include "operations/gimpcolorbalanceconfig.h"
+#include "operations/gimpcolorizeconfig.h"
+#include "operations/gimpcurvesconfig.h"
+#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"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_brightness_contrast_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble brightness;
+ gdouble contrast;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ brightness = g_value_get_double (gimp_value_array_index (args, 1));
+ contrast = g_value_get_double (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ 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_BRIGHTNESS_CONTRAST_CONFIG,
+ "brightness", brightness,
+ "contrast", contrast,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Brightness-Contrast"),
+ "gimp:brightness-contrast",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_color_balance_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 transfer_mode;
+ gboolean preserve_lum;
+ gdouble cyan_red;
+ gdouble magenta_green;
+ gdouble yellow_blue;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ transfer_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+ preserve_lum = g_value_get_boolean (gimp_value_array_index (args, 2));
+ cyan_red = g_value_get_double (gimp_value_array_index (args, 3));
+ magenta_green = g_value_get_double (gimp_value_array_index (args, 4));
+ yellow_blue = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ 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_COLOR_BALANCE_CONFIG,
+ "range", transfer_mode,
+ "preserve-luminosity", preserve_lum,
+ NULL);
+
+ g_object_set (config,
+ "cyan-red", cyan_red / 100.0,
+ "magenta-green", magenta_green / 100.0,
+ "yellow-blue", yellow_blue / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Color Balance"),
+ "gimp:color-balance",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_colorize_hsl_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble hue;
+ gdouble saturation;
+ gdouble lightness;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue = g_value_get_double (gimp_value_array_index (args, 1));
+ saturation = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ 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) &&
+ ! gimp_drawable_is_gray (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Colorize"),
+ "gimp:colorize",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_curves_explicit_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_bytes;
+ const guint8 *curve;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 2));
+ curve = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ 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) &&
+ (num_bytes == 256) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = gimp_curves_config_new_spline (channel,
+ curve,
+ num_bytes);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_curves_spline_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 num_points;
+ const guint8 *control_pts;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ num_points = g_value_get_int (gimp_value_array_index (args, 2));
+ control_pts = gimp_value_get_int8array (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ 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) &&
+ ! (num_points & 1) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = gimp_curves_config_new_spline (channel,
+ control_pts,
+ num_points);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_desaturate_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 desaturate_mode;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ desaturate_mode = g_value_get_enum (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ 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) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", desaturate_mode,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_equalize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gboolean mask_only;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ mask_only = g_value_get_boolean (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ 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))
+ success = FALSE;
+
+ if (success)
+ gimp_drawable_equalize (drawable, mask_only);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_histogram_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gint32 start_range;
+ gint32 end_range;
+ gdouble mean = 0.0;
+ gdouble std_dev = 0.0;
+ gdouble median = 0.0;
+ gdouble pixels = 0.0;
+ gdouble count = 0.0;
+ gdouble percentile = 0.0;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ start_range = g_value_get_int (gimp_value_array_index (args, 2));
+ end_range = g_value_get_int (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error) ||
+ (! gimp_drawable_has_alpha (drawable) &&
+ channel == GIMP_HISTOGRAM_ALPHA) ||
+ (gimp_drawable_is_gray (drawable) &&
+ channel != GIMP_HISTOGRAM_VALUE && channel != GIMP_HISTOGRAM_ALPHA))
+ success = FALSE;
+
+ if (success)
+ {
+ GimpHistogram *histogram = gimp_histogram_new (TRUE);
+ gint start = start_range;
+ gint end = end_range;
+ gint n_bins;
+
+ gimp_drawable_calculate_histogram (drawable, histogram);
+
+ n_bins = gimp_histogram_n_bins (histogram);
+
+ if (n_bins != 256)
+ {
+ start = ROUND ((gdouble) start * (n_bins - 1) / 255);
+ end = ROUND ((gdouble) end * (n_bins - 1) / 255);
+ }
+
+ mean = gimp_histogram_get_mean (histogram, channel,
+ start, end);
+ std_dev = gimp_histogram_get_std_dev (histogram, channel,
+ start, end);
+ median = gimp_histogram_get_median (histogram, channel,
+ start, end);
+ pixels = gimp_histogram_get_count (histogram, channel, 0, n_bins - 1);
+ count = gimp_histogram_get_count (histogram, channel,
+ start, end);
+ percentile = count / pixels;
+
+ g_object_unref (histogram);
+
+ if (n_bins == 256 ||
+ ! gimp->plug_in_manager->current_plug_in ||
+ ! gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in))
+ {
+ mean *= 255;
+ std_dev *= 255;
+ median *= 255;
+ }
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_double (gimp_value_array_index (return_vals, 1), mean);
+ g_value_set_double (gimp_value_array_index (return_vals, 2), std_dev);
+ g_value_set_double (gimp_value_array_index (return_vals, 3), median);
+ g_value_set_double (gimp_value_array_index (return_vals, 4), pixels);
+ g_value_set_double (gimp_value_array_index (return_vals, 5), count);
+ g_value_set_double (gimp_value_array_index (return_vals, 6), percentile);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+drawable_hue_saturation_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 hue_range;
+ gdouble hue_offset;
+ gdouble lightness;
+ gdouble saturation;
+ gdouble overlap;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ hue_range = g_value_get_enum (gimp_value_array_index (args, 1));
+ hue_offset = g_value_get_double (gimp_value_array_index (args, 2));
+ lightness = g_value_get_double (gimp_value_array_index (args, 3));
+ saturation = g_value_get_double (gimp_value_array_index (args, 4));
+ overlap = g_value_get_double (gimp_value_array_index (args, 5));
+
+ if (success)
+ {
+ 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_HUE_SATURATION_CONFIG,
+ "range", hue_range,
+ NULL);
+
+ g_object_set (config,
+ "hue", hue_offset / 180.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ "overlap", overlap / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Hue-Saturation"),
+ "gimp:hue-saturation",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_invert_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ 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))
+ {
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Invert"),
+ "gegl:invert-gamma",
+ NULL);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_levels_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 channel;
+ gdouble low_input;
+ gdouble high_input;
+ gdouble gamma;
+ gdouble low_output;
+ gdouble high_output;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ channel = g_value_get_enum (gimp_value_array_index (args, 1));
+ low_input = g_value_get_double (gimp_value_array_index (args, 2));
+ high_input = g_value_get_double (gimp_value_array_index (args, 3));
+ gamma = g_value_get_double (gimp_value_array_index (args, 4));
+ low_output = g_value_get_double (gimp_value_array_index (args, 5));
+ high_output = g_value_get_double (gimp_value_array_index (args, 6));
+
+ if (success)
+ {
+ 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) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_LEVELS_CONFIG,
+ "channel", channel,
+ NULL);
+
+ g_object_set (config,
+ "low-input", low_input,
+ "high-input", high_input,
+ "gamma", gamma,
+ "low-output", low_output,
+ "high-output", high_output,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Levels"),
+ "gimp:levels",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = TRUE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_levels_stretch_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ 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))
+ {
+ gimp_drawable_levels_stretch (drawable, progress);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_posterize_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 levels;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ levels = g_value_get_int (gimp_value_array_index (args, 1));
+
+ if (success)
+ {
+ 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);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Posterize"),
+ "gimp:posterize",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_threshold_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 low_threshold;
+ gint32 high_threshold;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+ low_threshold = g_value_get_int (gimp_value_array_index (args, 1));
+ high_threshold = g_value_get_int (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ 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_THRESHOLD_CONFIG,
+ "low", low_threshold / 255.0,
+ "high", high_threshold / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Threshold"),
+ "gimp:threshold",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_drawable_color_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-drawable-brightness-contrast
+ */
+ procedure = gimp_procedure_new (drawable_brightness_contrast_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-brightness-contrast");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-brightness-contrast",
+ "Modify brightness/contrast in the specified drawable.",
+ "This procedures allows the brightness and contrast of the specified
drawable to be modified. Both 'brightness' and 'contrast' parameters are defined between -0.5 and 0.5.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("brightness",
+ "brightness",
+ "Brightness adjustment",
+ -0.5, 0.5, -0.5,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("contrast",
+ "contrast",
+ "Contrast adjustment",
+ -0.5, 0.5, -0.5,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-color-balance
+ */
+ procedure = gimp_procedure_new (drawable_color_balance_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-color-balance");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-color-balance",
+ "Modify the color balance of the specified drawable.",
+ "Modify the color balance of the specified drawable. There are three
axis which can be modified: cyan-red, magenta-green, and yellow-blue. Negative values increase the amount of
the former, positive values increase the amount of the latter. Color balance can be controlled with the
'transfer_mode' setting, which allows shadows, mid-tones, and highlights in an image to be affected
differently. The 'preserve-lum' parameter, if TRUE, ensures that the luminosity of each pixel remains fixed.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("transfer-mode",
+ "transfer mode",
+ "Transfer mode",
+ GIMP_TYPE_TRANSFER_MODE,
+ GIMP_SHADOWS,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("preserve-lum",
+ "preserve lum",
+ "Preserve luminosity values at each pixel",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("cyan-red",
+ "cyan red",
+ "Cyan-Red color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("magenta-green",
+ "magenta green",
+ "Magenta-Green color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yellow-blue",
+ "yellow blue",
+ "Yellow-Blue color balance",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-colorize-hsl
+ */
+ procedure = gimp_procedure_new (drawable_colorize_hsl_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-colorize-hsl");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-colorize-hsl",
+ "Render the drawable as a grayscale image seen through a colored
glass.",
+ "Desaturates the drawable, then tints it with the specified color. This
tool is only valid on RGB color images. It will not operate on grayscale drawables.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2004",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue",
+ "hue",
+ "Hue in degrees",
+ 0, 360, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation in percent",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness in percent",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-curves-explicit
+ */
+ procedure = gimp_procedure_new (drawable_curves_explicit_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-curves-explicit");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-curves-explicit",
+ "Modifies the intensity curve(s) for specified drawable.",
+ "Modifies the intensity mapping for one channel in the specified
drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component,
or the value. The 'curve' parameter is an array of bytes which explicitly defines how each pixel value in the
drawable will be modified. Use the 'gimp-curves-spline' function to modify intensity levels with Catmull Rom
splines.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "The number of bytes in the new curve (always 256)",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("curve",
+ "curve",
+ "The explicit curve",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-curves-spline
+ */
+ procedure = gimp_procedure_new (drawable_curves_spline_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-curves-spline");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-curves-spline",
+ "Modifies the intensity curve(s) for specified drawable.",
+ "Modifies the intensity mapping for one channel in the specified
drawable. The drawable must be either grayscale or RGB, and the channel can be either an intensity component,
or the value. The 'control_pts' parameter is an array of integers which define a set of control points which
describe a Catmull Rom spline which yields the final intensity curve. Use the 'gimp-curves-explicit' function
to explicitly modify intensity levels.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-points",
+ "num points",
+ "The number of values in the control point array",
+ 4, 34, 4,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("control-pts",
+ "control pts",
+ "The spline control points: { cp1.x, cp1.y,
cp2.x, cp2.y, ... }",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-desaturate
+ */
+ procedure = gimp_procedure_new (drawable_desaturate_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-desaturate");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-desaturate",
+ "Desaturate the contents of the specified drawable, with the specified
formula.",
+ "This procedure desaturates the contents of the specified drawable,
with the specified formula. This procedure only works on drawables of type RGB color.",
+ "Karine Delvare",
+ "Karine Delvare",
+ "2005",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("desaturate-mode",
+ "desaturate mode",
+ "The formula to use to desaturate",
+ GIMP_TYPE_DESATURATE_MODE,
+ GIMP_DESATURATE_LIGHTNESS,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-equalize
+ */
+ procedure = gimp_procedure_new (drawable_equalize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-equalize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-equalize",
+ "Equalize the contents of the specified drawable.",
+ "This procedure equalizes the contents of the specified drawable. Each
intensity channel is equalized independently. The equalized intensity is given as inten' = (255 - inten). The
'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the
entire image based on the histogram of the selected area. If there is no selection, the entire image is
adjusted based on the histogram for the entire image.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("mask-only",
+ "mask only",
+ "Equalization option",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-histogram
+ */
+ procedure = gimp_procedure_new (drawable_histogram_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-histogram");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-histogram",
+ "Returns information on the intensity histogram for the specified
drawable.",
+ "This tool makes it possible to gather information about the intensity
histogram of a drawable. A channel to examine is first specified. This can be either value, red, green, or
blue, depending on whether the drawable is of type color or grayscale. Second, a range of intensities are
specified. The 'gimp-histogram' function returns statistics based on the pixels in the drawable that fall
under this range of values. Mean, standard deviation, median, number of pixels, and percentile are all
returned. Additionally, the total count of pixels in the image is returned. Counts of pixels are weighted by
any associated alpha values and by the current selection mask. That is, pixels that lie outside an active
selection mask will not be counted. Similarly, pixels with transparent alpha values will not be counted. The
returned mean, std_dev and median are in the range (0..255) for 8-bit images, or if the plug-in is not
precision-aware, and in the rang
e (0.0..1.0) otherwise.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("start-range",
+ "start range",
+ "Start of the intensity measurement range",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("end-range",
+ "end range",
+ "End of the intensity measurement range",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("mean",
+ "mean",
+ "Mean intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("std-dev",
+ "std dev",
+ "Standard deviation of intensity values",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("median",
+ "median",
+ "Median intensity value",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("pixels",
+ "pixels",
+ "Alpha-weighted pixel count for entire image",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("count",
+ "count",
+ "Alpha-weighted pixel count for range",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_double ("percentile",
+ "percentile",
+ "Percentile that range falls under",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-hue-saturation
+ */
+ procedure = gimp_procedure_new (drawable_hue_saturation_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-hue-saturation");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-hue-saturation",
+ "Modify hue, lightness, and saturation in the specified drawable.",
+ "This procedure allows the hue, lightness, and saturation in the
specified drawable to be modified. The 'hue-range' parameter provides the capability to limit range of
affected hues. The 'overlap' parameter provides blending into neighboring hue channels when rendering.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("hue-range",
+ "hue range",
+ "Range of affected hues",
+ GIMP_TYPE_HUE_RANGE,
+ GIMP_ALL_HUES,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("hue-offset",
+ "hue offset",
+ "Hue offset in degrees",
+ -180, 180, -180,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("lightness",
+ "lightness",
+ "Lightness modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("saturation",
+ "saturation",
+ "Saturation modification",
+ -100, 100, -100,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("overlap",
+ "overlap",
+ "Overlap other hue channels",
+ 0, 100, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-invert
+ */
+ procedure = gimp_procedure_new (drawable_invert_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-invert");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-invert",
+ "Invert the contents of the specified drawable.",
+ "This procedure inverts the contents of the specified drawable. Each
intensity channel is inverted independently. The inverted intensity is given as inten' = (255 - inten).",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-levels
+ */
+ procedure = gimp_procedure_new (drawable_levels_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-levels");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-levels",
+ "Modifies intensity levels in the specified drawable.",
+ "This tool allows intensity levels in the specified drawable to be
remapped according to a set of parameters. The low/high input levels specify an initial mapping from the
source intensities. The gamma value determines how intensities between the low and high input intensities are
interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more
high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels
constrain the final intensity mapping--that is, no final intensity will be lower than the low output level
and no final intensity will be higher than the high output level. This tool is only valid on RGB color and
grayscale images.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1995-1996",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("channel",
+ "channel",
+ "The channel to modify",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("low-input",
+ "low input",
+ "Intensity of lowest input",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("high-input",
+ "high input",
+ "Intensity of highest input",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("gamma",
+ "gamma",
+ "Gamma correction factor",
+ 0.1, 10, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("low-output",
+ "low output",
+ "Intensity of lowest output",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("high-output",
+ "high output",
+ "Intensity of highest output",
+ 0.0, 1.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-levels-stretch
+ */
+ procedure = gimp_procedure_new (drawable_levels_stretch_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-levels-stretch");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-levels-stretch",
+ "Automatically modifies intensity levels in the specified drawable.",
+ "This procedure allows intensity levels in the specified drawable to be
remapped according to a set of guessed parameters. It is equivalent to clicking the \"Auto\" button in the
Levels tool.",
+ "Joao S.O. Bueno, Shawn Willden",
+ "Joao S.O. Bueno, Shawn Willden",
+ "2003",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-posterize
+ */
+ procedure = gimp_procedure_new (drawable_posterize_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-posterize");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-posterize",
+ "Posterize the specified drawable.",
+ "This procedures reduces the number of shades allows in each intensity
channel to the specified 'levels' parameter.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("levels",
+ "levels",
+ "Levels of posterization",
+ 2, 255, 2,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-drawable-threshold
+ */
+ procedure = gimp_procedure_new (drawable_threshold_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-threshold");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-threshold",
+ "Threshold the specified drawable.",
+ "This procedures generates a threshold map of the specified drawable.
All pixels between the values of 'low_threshold' and 'high_threshold' are replaced with white, and all other
pixels with black.",
+ "Spencer Kimball & Peter Mattis",
+ "Spencer Kimball & Peter Mattis",
+ "1997",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("low-threshold",
+ "low threshold",
+ "The low threshold value",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("high-threshold",
+ "high threshold",
+ "The high threshold value",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index b9f1214..39cfc35 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 707 procedures registered total */
+/* 720 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@@ -45,6 +45,7 @@ internal_procs_init (GimpPDB *pdb)
register_convert_procs (pdb);
register_display_procs (pdb);
register_drawable_procs (pdb);
+ register_drawable_color_procs (pdb);
register_drawable_transform_procs (pdb);
register_dynamics_procs (pdb);
register_edit_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index 0c82c9b..c346f26 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -34,6 +34,7 @@ void register_context_procs (GimpPDB *pdb);
void register_convert_procs (GimpPDB *pdb);
void register_display_procs (GimpPDB *pdb);
void register_drawable_procs (GimpPDB *pdb);
+void register_drawable_color_procs (GimpPDB *pdb);
void register_drawable_transform_procs (GimpPDB *pdb);
void register_dynamics_procs (GimpPDB *pdb);
void register_edit_procs (GimpPDB *pdb);
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index c505a99..e6570df 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -86,6 +86,7 @@ PDB_WRAPPERS_C = \
gimpconvert_pdb.c \
gimpdisplay_pdb.c \
gimpdrawable_pdb.c \
+ gimpdrawablecolor_pdb.c \
gimpdrawabletransform_pdb.c \
gimpdynamics_pdb.c \
gimpedit_pdb.c \
@@ -139,6 +140,7 @@ PDB_WRAPPERS_H = \
gimpconvert_pdb.h \
gimpdisplay_pdb.h \
gimpdrawable_pdb.h \
+ gimpdrawablecolor_pdb.h \
gimpdrawabletransform_pdb.h \
gimpdynamics_pdb.h \
gimpedit_pdb.h \
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 215ce71..3f44264 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -170,8 +170,15 @@ EXPORTS
gimp_dodgeburn_default
gimp_drawable_attach_new_parasite
gimp_drawable_bpp
+ gimp_drawable_brightness_contrast
+ gimp_drawable_color_balance
+ gimp_drawable_colorize_hsl
+ gimp_drawable_curves_explicit
+ gimp_drawable_curves_spline
gimp_drawable_delete
+ gimp_drawable_desaturate
gimp_drawable_detach
+ gimp_drawable_equalize
gimp_drawable_fill
gimp_drawable_flush
gimp_drawable_foreground_extract
@@ -195,6 +202,9 @@ EXPORTS
gimp_drawable_get_visible
gimp_drawable_has_alpha
gimp_drawable_height
+ gimp_drawable_historgram
+ gimp_drawable_hue_saturation
+ gimp_drawable_invert
gimp_drawable_is_channel
gimp_drawable_is_gray
gimp_drawable_is_indexed
@@ -203,6 +213,8 @@ EXPORTS
gimp_drawable_is_rgb
gimp_drawable_is_text_layer
gimp_drawable_is_valid
+ gimp_drawable_levels
+ gimp_drawable_levels_stretch
gimp_drawable_mask_bounds
gimp_drawable_mask_intersect
gimp_drawable_merge_shadow
@@ -212,12 +224,14 @@ EXPORTS
gimp_drawable_parasite_detach
gimp_drawable_parasite_find
gimp_drawable_parasite_list
+ gimp_drawable_posterize
gimp_drawable_set_image
gimp_drawable_set_linked
gimp_drawable_set_name
gimp_drawable_set_pixel
gimp_drawable_set_tattoo
gimp_drawable_set_visible
+ gimp_drawable_threshold
gimp_drawable_transform_2d
gimp_drawable_transform_2d_default
gimp_drawable_transform_flip
@@ -356,7 +370,6 @@ EXPORTS
gimp_histogram_channel_get_type
gimp_hue_range_get_type
gimp_hue_saturation
- gimp_hue_saturation_overlap
gimp_image_add_channel
gimp_image_add_hguide
gimp_image_add_layer
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 195c729..3e2f5e6 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -38,6 +38,7 @@
#include <libgimp/gimpconvert_pdb.h>
#include <libgimp/gimpdisplay_pdb.h>
#include <libgimp/gimpdrawable_pdb.h>
+#include <libgimp/gimpdrawablecolor_pdb.h>
#include <libgimp/gimpdrawabletransform_pdb.h>
#include <libgimp/gimpdynamics_pdb.h>
#include <libgimp/gimpedit_pdb.h>
diff --git a/libgimp/gimpcolor_pdb.c b/libgimp/gimpcolor_pdb.c
index 0f864cd..25b8f28 100644
--- a/libgimp/gimpcolor_pdb.c
+++ b/libgimp/gimpcolor_pdb.c
@@ -40,11 +40,7 @@
* @brightness: Brightness adjustment.
* @contrast: Contrast adjustment.
*
- * Modify brightness/contrast in the specified drawable.
- *
- * This procedures allows the brightness and contrast of the specified
- * drawable to be modified. Both 'brightness' and 'contrast' parameters
- * are defined between -127 and 127.
+ * Deprecated: Use gimp_drawable_brightness_contrast() instead.
*
* Returns: TRUE on success.
**/
@@ -81,20 +77,7 @@ gimp_brightness_contrast (gint32 drawable_ID,
* @low_output: Intensity of lowest output.
* @high_output: Intensity of highest output.
*
- * Modifies intensity levels in the specified drawable.
- *
- * This tool allows intensity levels in the specified drawable to be
- * remapped according to a set of parameters. The low/high input levels
- * specify an initial mapping from the source intensities. The gamma
- * value determines how intensities between the low and high input
- * intensities are interpolated. A gamma value of 1.0 results in a
- * linear interpolation. Higher gamma values result in more high-level
- * intensities. Lower gamma values result in more low-level
- * intensities. The low/high output levels constrain the final
- * intensity mapping--that is, no final intensity will be lower than
- * the low output level and no final intensity will be higher than the
- * high output level. This tool is only valid on RGB color and
- * grayscale images.
+ * Deprecated: Use gimp_drawable_levels() instead.
*
* Returns: TRUE on success.
**/
@@ -133,7 +116,7 @@ gimp_levels (gint32 drawable_ID,
* gimp_levels_auto:
* @drawable_ID: The drawable.
*
- * Deprecated: Use gimp_levels_stretch() instead.
+ * Deprecated: Use gimp_drawable_levels_stretch() instead.
*
* Returns: TRUE on success.
**/
@@ -160,11 +143,7 @@ gimp_levels_auto (gint32 drawable_ID)
* gimp_levels_stretch:
* @drawable_ID: The drawable.
*
- * Automatically modifies intensity levels in the specified drawable.
- *
- * This procedure allows intensity levels in the specified drawable to
- * be remapped according to a set of guessed parameters. It is
- * equivalent to clicking the \"Auto\" button in the Levels tool.
+ * Deprecated: Use gimp_drawable_levels_stretch() instead.
*
* Returns: TRUE on success.
**/
@@ -192,10 +171,7 @@ gimp_levels_stretch (gint32 drawable_ID)
* @drawable_ID: The drawable.
* @levels: Levels of posterization.
*
- * Posterize the specified drawable.
- *
- * This procedures reduces the number of shades allows in each
- * intensity channel to the specified 'levels' parameter.
+ * Deprecated: Use gimp_drawable_posterize() instead.
*
* Returns: TRUE on success.
**/
@@ -224,10 +200,7 @@ gimp_posterize (gint32 drawable_ID,
* gimp_desaturate:
* @drawable_ID: The drawable.
*
- * Desaturate the contents of the specified drawable.
- *
- * This procedure desaturates the contents of the specified drawable.
- * This procedure only works on drawables of type RGB color.
+ * Deprecated: Use gimp_drawable_desaturate() instead.
*
* Returns: TRUE on success.
**/
@@ -255,12 +228,7 @@ gimp_desaturate (gint32 drawable_ID)
* @drawable_ID: The drawable.
* @desaturate_mode: The formula to use to desaturate.
*
- * Desaturate the contents of the specified drawable, with the
- * specified formula.
- *
- * This procedure desaturates the contents of the specified drawable,
- * with the specified formula. This procedure only works on drawables
- * of type RGB color.
+ * Deprecated: Use gimp_drawable_desaturate() instead.
*
* Returns: TRUE on success.
*
@@ -292,15 +260,7 @@ gimp_desaturate_full (gint32 drawable_ID,
* @drawable_ID: The drawable.
* @mask_only: Equalization option.
*
- * Equalize the contents of the specified drawable.
- *
- * This procedure equalizes the contents of the specified drawable.
- * Each intensity channel is equalized independently. The equalized
- * intensity is given as inten' = (255 - inten). The 'mask_only' option
- * specifies whether to adjust only the area of the image within the
- * selection bounds, or the entire image based on the histogram of the
- * selected area. If there is no selection, the entire image is
- * adjusted based on the histogram for the entire image.
+ * Deprecated: Use gimp_drawable_equalize() instead.
*
* Returns: TRUE on success.
**/
@@ -502,16 +462,9 @@ gimp_color_balance (gint32 drawable_ID,
* @saturation: Saturation in percent.
* @lightness: Lightness in percent.
*
- * Render the drawable as a grayscale image seen through a colored
- * glass.
- *
- * Desaturates the drawable, then tints it with the specified color.
- * This tool is only valid on RGB color images. It will not operate on
- * grayscale drawables.
+ * Deprecated: Use gimp_drawable_colorize_hsl() instead.
*
* Returns: TRUE on success.
- *
- * Since: GIMP 2.2
**/
gboolean
gimp_colorize (gint32 drawable_ID,
@@ -628,11 +581,7 @@ gimp_histogram (gint32 drawable_ID,
* @lightness: Lightness modification.
* @saturation: Saturation modification.
*
- * Modify hue, lightness, and saturation in the specified drawable.
- *
- * This procedure allows the hue, lightness, and saturation in the
- * specified drawable to be modified. The 'hue-range' parameter
- * provides the capability to limit range of affected hues.
+ * Deprecated: Use gimp_drawable_hue_saturation() instead.
*
* Returns: TRUE on success.
**/
@@ -664,56 +613,6 @@ gimp_hue_saturation (gint32 drawable_ID,
}
/**
- * gimp_hue_saturation_overlap:
- * @drawable_ID: The drawable.
- * @hue_range: Range of affected hues.
- * @hue_offset: Hue offset in degrees.
- * @lightness: Lightness modification.
- * @saturation: Saturation modification.
- * @overlap: Overlap other hue channels.
- *
- * Modify hue, lightness, and saturation in the specified drawable.
- *
- * This procedure allows the hue, lightness, and saturation in the
- * specified drawable to be modified. The 'hue-range' parameter
- * provides the capability to limit range of affected hues. The
- * 'overlap' parameter provides blending into neighboring hue channels
- * when rendering.
- *
- * Returns: TRUE on success.
- *
- * Since: GIMP 2.10
- **/
-gboolean
-gimp_hue_saturation_overlap (gint32 drawable_ID,
- GimpHueRange hue_range,
- gdouble hue_offset,
- gdouble lightness,
- gdouble saturation,
- gdouble overlap)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- gboolean success = TRUE;
-
- return_vals = gimp_run_procedure ("gimp-hue-saturation-overlap",
- &nreturn_vals,
- GIMP_PDB_DRAWABLE, drawable_ID,
- GIMP_PDB_INT32, hue_range,
- GIMP_PDB_FLOAT, hue_offset,
- GIMP_PDB_FLOAT, lightness,
- GIMP_PDB_FLOAT, saturation,
- GIMP_PDB_FLOAT, overlap,
- GIMP_PDB_END);
-
- success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return success;
-}
-
-/**
* gimp_threshold:
* @drawable_ID: The drawable.
* @low_threshold: The low threshold value.
diff --git a/libgimp/gimpcolor_pdb.h b/libgimp/gimpcolor_pdb.h
index ffdfd10..1fa246c 100644
--- a/libgimp/gimpcolor_pdb.h
+++ b/libgimp/gimpcolor_pdb.h
@@ -32,69 +32,72 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_brightness_contrast (gint32 drawable_ID,
- gint brightness,
- gint contrast);
-gboolean gimp_levels (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gint low_input,
- gint high_input,
- gdouble gamma,
- gint low_output,
- gint high_output);
-GIMP_DEPRECATED_FOR(gimp_levels_stretch)
-gboolean gimp_levels_auto (gint32 drawable_ID);
-gboolean gimp_levels_stretch (gint32 drawable_ID);
-gboolean gimp_posterize (gint32 drawable_ID,
- gint levels);
-gboolean gimp_desaturate (gint32 drawable_ID);
-gboolean gimp_desaturate_full (gint32 drawable_ID,
- GimpDesaturateMode desaturate_mode);
-gboolean gimp_equalize (gint32 drawable_ID,
- gboolean mask_only);
-gboolean gimp_invert (gint32 drawable_ID);
-gboolean gimp_curves_spline (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gint num_points,
- const guint8 *control_pts);
-gboolean gimp_curves_explicit (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gint num_bytes,
- const guint8 *curve);
-gboolean gimp_color_balance (gint32 drawable_ID,
- GimpTransferMode transfer_mode,
- gboolean preserve_lum,
- gdouble cyan_red,
- gdouble magenta_green,
- gdouble yellow_blue);
-gboolean gimp_colorize (gint32 drawable_ID,
- gdouble hue,
- gdouble saturation,
- gdouble lightness);
-gboolean gimp_histogram (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gint start_range,
- gint end_range,
- gdouble *mean,
- gdouble *std_dev,
- gdouble *median,
- gdouble *pixels,
- gdouble *count,
- gdouble *percentile);
-gboolean gimp_hue_saturation (gint32 drawable_ID,
- GimpHueRange hue_range,
- gdouble hue_offset,
- gdouble lightness,
- gdouble saturation);
-gboolean gimp_hue_saturation_overlap (gint32 drawable_ID,
- GimpHueRange hue_range,
- gdouble hue_offset,
- gdouble lightness,
- gdouble saturation,
- gdouble overlap);
-gboolean gimp_threshold (gint32 drawable_ID,
- gint low_threshold,
- gint high_threshold);
+GIMP_DEPRECATED_FOR(gimp_drawable_brightness_contrast)
+gboolean gimp_brightness_contrast (gint32 drawable_ID,
+ gint brightness,
+ gint contrast);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels)
+gboolean gimp_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint low_input,
+ gint high_input,
+ gdouble gamma,
+ gint low_output,
+ gint high_output);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels_stretch)
+gboolean gimp_levels_auto (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_levels_stretch)
+gboolean gimp_levels_stretch (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_posterize)
+gboolean gimp_posterize (gint32 drawable_ID,
+ gint levels);
+GIMP_DEPRECATED_FOR(gimp_drawable_desaturate)
+gboolean gimp_desaturate (gint32 drawable_ID);
+GIMP_DEPRECATED_FOR(gimp_drawable_desaturate)
+gboolean gimp_desaturate_full (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode);
+GIMP_DEPRECATED_FOR(gimp_drawable_equalize)
+gboolean gimp_equalize (gint32 drawable_ID,
+ gboolean mask_only);
+gboolean gimp_invert (gint32 drawable_ID);
+gboolean gimp_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const guint8 *control_pts);
+gboolean gimp_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_bytes,
+ const guint8 *curve);
+gboolean gimp_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue);
+GIMP_DEPRECATED_FOR(gimp_drawable_colorize_hsl)
+gboolean gimp_colorize (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness);
+gboolean gimp_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint start_range,
+ gint end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile);
+GIMP_DEPRECATED_FOR(gimp_drawable_hue_saturation)
+gboolean gimp_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation);
+gboolean gimp_threshold (gint32 drawable_ID,
+ gint low_threshold,
+ gint high_threshold);
G_END_DECLS
diff --git a/libgimp/gimpdrawablecolor_pdb.c b/libgimp/gimpdrawablecolor_pdb.c
new file mode 100644
index 0000000..46370f8
--- /dev/null
+++ b/libgimp/gimpdrawablecolor_pdb.c
@@ -0,0 +1,675 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablecolor_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawablecolor
+ * @title: gimpdrawablecolor
+ * @short_description: Functions for manipulating a drawable's color.
+ *
+ * Functions for manipulating a drawable's color, including curves and
+ * histograms.
+ **/
+
+
+/**
+ * gimp_drawable_brightness_contrast:
+ * @drawable_ID: The drawable.
+ * @brightness: Brightness adjustment.
+ * @contrast: Contrast adjustment.
+ *
+ * Modify brightness/contrast in the specified drawable.
+ *
+ * This procedures allows the brightness and contrast of the specified
+ * drawable to be modified. Both 'brightness' and 'contrast' parameters
+ * are defined between -0.5 and 0.5.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-brightness-contrast",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, brightness,
+ GIMP_PDB_FLOAT, contrast,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_color_balance:
+ * @drawable_ID: The drawable.
+ * @transfer_mode: Transfer mode.
+ * @preserve_lum: Preserve luminosity values at each pixel.
+ * @cyan_red: Cyan-Red color balance.
+ * @magenta_green: Magenta-Green color balance.
+ * @yellow_blue: Yellow-Blue color balance.
+ *
+ * Modify the color balance of the specified drawable.
+ *
+ * Modify the color balance of the specified drawable. There are three
+ * axis which can be modified: cyan-red, magenta-green, and
+ * yellow-blue. Negative values increase the amount of the former,
+ * positive values increase the amount of the latter. Color balance can
+ * be controlled with the 'transfer_mode' setting, which allows
+ * shadows, mid-tones, and highlights in an image to be affected
+ * differently. The 'preserve-lum' parameter, if TRUE, ensures that the
+ * luminosity of each pixel remains fixed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-color-balance",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, transfer_mode,
+ GIMP_PDB_INT32, preserve_lum,
+ GIMP_PDB_FLOAT, cyan_red,
+ GIMP_PDB_FLOAT, magenta_green,
+ GIMP_PDB_FLOAT, yellow_blue,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_colorize_hsl:
+ * @drawable_ID: The drawable.
+ * @hue: Hue in degrees.
+ * @saturation: Saturation in percent.
+ * @lightness: Lightness in percent.
+ *
+ * Render the drawable as a grayscale image seen through a colored
+ * glass.
+ *
+ * Desaturates the drawable, then tints it with the specified color.
+ * This tool is only valid on RGB color images. It will not operate on
+ * grayscale drawables.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-colorize-hsl",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_FLOAT, hue,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_curves_explicit:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_bytes: The number of bytes in the new curve (always 256).
+ * @curve: The explicit curve.
+ *
+ * Modifies the intensity curve(s) for specified drawable.
+ *
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The drawable must be either grayscale or RGB, and the
+ * channel can be either an intensity component, or the value. The
+ * 'curve' parameter is an array of bytes which explicitly defines how
+ * each pixel value in the drawable will be modified. Use the
+ * gimp_curves_spline() function to modify intensity levels with
+ * Catmull Rom splines.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_bytes,
+ const guint8 *curve)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-curves-explicit",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, curve,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_curves_spline:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_points: The number of values in the control point array.
+ * @control_pts: The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
+ *
+ * Modifies the intensity curve(s) for specified drawable.
+ *
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The drawable must be either grayscale or RGB, and the
+ * channel can be either an intensity component, or the value. The
+ * 'control_pts' parameter is an array of integers which define a set
+ * of control points which describe a Catmull Rom spline which yields
+ * the final intensity curve. Use the gimp_curves_explicit() function
+ * to explicitly modify intensity levels.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const guint8 *control_pts)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-curves-spline",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, num_points,
+ GIMP_PDB_INT8ARRAY, control_pts,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_desaturate:
+ * @drawable_ID: The drawable.
+ * @desaturate_mode: The formula to use to desaturate.
+ *
+ * Desaturate the contents of the specified drawable, with the
+ * specified formula.
+ *
+ * This procedure desaturates the contents of the specified drawable,
+ * with the specified formula. This procedure only works on drawables
+ * of type RGB color.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-desaturate",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, desaturate_mode,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_equalize:
+ * @drawable_ID: The drawable.
+ * @mask_only: Equalization option.
+ *
+ * Equalize the contents of the specified drawable.
+ *
+ * This procedure equalizes the contents of the specified drawable.
+ * Each intensity channel is equalized independently. The equalized
+ * intensity is given as inten' = (255 - inten). The 'mask_only' option
+ * specifies whether to adjust only the area of the image within the
+ * selection bounds, or the entire image based on the histogram of the
+ * selected area. If there is no selection, the entire image is
+ * adjusted based on the histogram for the entire image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-equalize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, mask_only,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_histogram:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @start_range: Start of the intensity measurement range.
+ * @end_range: End of the intensity measurement range.
+ * @mean: Mean intensity value.
+ * @std_dev: Standard deviation of intensity values.
+ * @median: Median intensity value.
+ * @pixels: Alpha-weighted pixel count for entire image.
+ * @count: Alpha-weighted pixel count for range.
+ * @percentile: Percentile that range falls under.
+ *
+ * Returns information on the intensity histogram for the specified
+ * drawable.
+ *
+ * This tool makes it possible to gather information about the
+ * intensity histogram of a drawable. A channel to examine is first
+ * specified. This can be either value, red, green, or blue, depending
+ * on whether the drawable is of type color or grayscale. Second, a
+ * range of intensities are specified. The gimp_histogram() function
+ * returns statistics based on the pixels in the drawable that fall
+ * under this range of values. Mean, standard deviation, median, number
+ * of pixels, and percentile are all returned. Additionally, the total
+ * count of pixels in the image is returned. Counts of pixels are
+ * weighted by any associated alpha values and by the current selection
+ * mask. That is, pixels that lie outside an active selection mask will
+ * not be counted. Similarly, pixels with transparent alpha values will
+ * not be counted. The returned mean, std_dev and median are in the
+ * range (0..255) for 8-bit images, or if the plug-in is not
+ * precision-aware, and in the range (0.0..1.0) otherwise.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint start_range,
+ gint end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-histogram",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_INT32, start_range,
+ GIMP_PDB_INT32, end_range,
+ GIMP_PDB_END);
+
+ *mean = 0.0;
+ *std_dev = 0.0;
+ *median = 0.0;
+ *pixels = 0.0;
+ *count = 0.0;
+ *percentile = 0.0;
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *mean = return_vals[1].data.d_float;
+ *std_dev = return_vals[2].data.d_float;
+ *median = return_vals[3].data.d_float;
+ *pixels = return_vals[4].data.d_float;
+ *count = return_vals[5].data.d_float;
+ *percentile = return_vals[6].data.d_float;
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_hue_saturation:
+ * @drawable_ID: The drawable.
+ * @hue_range: Range of affected hues.
+ * @hue_offset: Hue offset in degrees.
+ * @lightness: Lightness modification.
+ * @saturation: Saturation modification.
+ * @overlap: Overlap other hue channels.
+ *
+ * Modify hue, lightness, and saturation in the specified drawable.
+ *
+ * This procedure allows the hue, lightness, and saturation in the
+ * specified drawable to be modified. The 'hue-range' parameter
+ * provides the capability to limit range of affected hues. The
+ * 'overlap' parameter provides blending into neighboring hue channels
+ * when rendering.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-hue-saturation",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, hue_range,
+ GIMP_PDB_FLOAT, hue_offset,
+ GIMP_PDB_FLOAT, lightness,
+ GIMP_PDB_FLOAT, saturation,
+ GIMP_PDB_FLOAT, overlap,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_invert:
+ * @drawable_ID: The drawable.
+ *
+ * Invert the contents of the specified drawable.
+ *
+ * This procedure inverts the contents of the specified drawable. Each
+ * intensity channel is inverted independently. The inverted intensity
+ * is given as inten' = (255 - inten).
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_invert (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-invert",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_levels:
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @low_input: Intensity of lowest input.
+ * @high_input: Intensity of highest input.
+ * @gamma: Gamma correction factor.
+ * @low_output: Intensity of lowest output.
+ * @high_output: Intensity of highest output.
+ *
+ * Modifies intensity levels in the specified drawable.
+ *
+ * This tool allows intensity levels in the specified drawable to be
+ * remapped according to a set of parameters. The low/high input levels
+ * specify an initial mapping from the source intensities. The gamma
+ * value determines how intensities between the low and high input
+ * intensities are interpolated. A gamma value of 1.0 results in a
+ * linear interpolation. Higher gamma values result in more high-level
+ * intensities. Lower gamma values result in more low-level
+ * intensities. The low/high output levels constrain the final
+ * intensity mapping--that is, no final intensity will be lower than
+ * the low output level and no final intensity will be higher than the
+ * high output level. This tool is only valid on RGB color and
+ * grayscale images.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-levels",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, channel,
+ GIMP_PDB_FLOAT, low_input,
+ GIMP_PDB_FLOAT, high_input,
+ GIMP_PDB_FLOAT, gamma,
+ GIMP_PDB_FLOAT, low_output,
+ GIMP_PDB_FLOAT, high_output,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_levels_stretch:
+ * @drawable_ID: The drawable.
+ *
+ * Automatically modifies intensity levels in the specified drawable.
+ *
+ * This procedure allows intensity levels in the specified drawable to
+ * be remapped according to a set of guessed parameters. It is
+ * equivalent to clicking the \"Auto\" button in the Levels tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_levels_stretch (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-levels-stretch",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_posterize:
+ * @drawable_ID: The drawable.
+ * @levels: Levels of posterization.
+ *
+ * Posterize the specified drawable.
+ *
+ * This procedures reduces the number of shades allows in each
+ * intensity channel to the specified 'levels' parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-posterize",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, levels,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_threshold:
+ * @drawable_ID: The drawable.
+ * @low_threshold: The low threshold value.
+ * @high_threshold: The high threshold value.
+ *
+ * Threshold the specified drawable.
+ *
+ * This procedures generates a threshold map of the specified drawable.
+ * All pixels between the values of 'low_threshold' and
+ * 'high_threshold' are replaced with white, and all other pixels with
+ * black.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.10
+ **/
+gboolean
+gimp_drawable_threshold (gint32 drawable_ID,
+ gint low_threshold,
+ gint high_threshold)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-threshold",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_INT32, low_threshold,
+ GIMP_PDB_INT32, high_threshold,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpdrawablecolor_pdb.h b/libgimp/gimpdrawablecolor_pdb.h
new file mode 100644
index 0000000..e44ca59
--- /dev/null
+++ b/libgimp/gimpdrawablecolor_pdb.h
@@ -0,0 +1,94 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawablecolor_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_COLOR_PDB_H__
+#define __GIMP_DRAWABLE_COLOR_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast);
+gboolean gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue);
+gboolean gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness);
+gboolean gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_bytes,
+ const guint8 *curve);
+gboolean gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const guint8 *control_pts);
+gboolean gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode);
+gboolean gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only);
+gboolean gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint start_range,
+ gint end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile);
+gboolean gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap);
+gboolean gimp_drawable_invert (gint32 drawable_ID);
+gboolean gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output);
+gboolean gimp_drawable_levels_stretch (gint32 drawable_ID);
+gboolean gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels);
+gboolean gimp_drawable_threshold (gint32 drawable_ID,
+ gint low_threshold,
+ gint high_threshold);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_COLOR_PDB_H__ */
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index 4c98901..195ded0 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -12,6 +12,7 @@ pdb_sources = \
pdb/convert.pdb \
pdb/display.pdb \
pdb/drawable.pdb \
+ pdb/drawable_color.pdb \
pdb/drawable_transform.pdb \
pdb/dynamics.pdb \
pdb/edit.pdb \
diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl
index c82e90e..399a1ef 100644
--- a/tools/pdbgen/groups.pl
+++ b/tools/pdbgen/groups.pl
@@ -10,6 +10,7 @@
convert
display
drawable
+ drawable_color
drawable_transform
dynamics
edit
diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb
index 9c2a31e..057075a 100644
--- a/tools/pdbgen/pdb/color.pdb
+++ b/tools/pdbgen/pdb/color.pdb
@@ -17,16 +17,7 @@
# "Perlized" from C source by Manish Singh <yosh gimp org>
sub brightness_contrast {
- $blurb = 'Modify brightness/contrast in the specified drawable.';
-
- $help = <<'HELP';
-This procedures allows the brightness and contrast of the specified drawable to
-be modified. Both 'brightness' and 'contrast' parameters are defined between
--127 and 127.
-HELP
-
- &std_pdb_misc;
- $date = '1997';
+ &std_pdb_deprecated ('gimp-drawable-brightness-contrast');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -64,22 +55,7 @@ CODE
}
sub levels {
- $blurb = 'Modifies intensity levels in the specified drawable.';
-
- $help = <<'HELP';
-This tool allows intensity levels in the specified drawable to be remapped
-according to a set of parameters. The low/high input levels specify an initial
-mapping from the source intensities. The gamma value determines how intensities
-between the low and high input intensities are interpolated. A gamma value of
-1.0 results in a linear interpolation. Higher gamma values result in more
-high-level intensities. Lower gamma values result in more low-level
-intensities. The low/high output levels constrain the final intensity
-mapping--that is, no final intensity will be lower than the low output level
-and no final intensity will be higher than the high output level. This tool is
-only valid on RGB color and grayscale images.
-HELP
-
- &std_pdb_misc;
+ &std_pdb_deprecated ('gimp-drawable-levels');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -135,16 +111,7 @@ CODE
}
sub levels_stretch {
- $blurb = 'Automatically modifies intensity levels in the specified drawable.';
-
- $help = <<'HELP';
-This procedure allows intensity levels in the specified drawable to be
-remapped according to a set of guessed parameters. It is equivalent to
-clicking the "Auto" button in the Levels tool.
-HELP
-
- $author = $copyright = 'Joao S.O. Bueno, Shawn Willden';
- $date = '2003';
+ &std_pdb_deprecated ('gimp-drawable-levels-stretch');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -169,7 +136,7 @@ CODE
}
sub levels_auto {
- &std_pdb_deprecated ('gimp-levels-stretch');
+ &std_pdb_deprecated ('gimp-drawable-levels-stretch');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -194,15 +161,7 @@ CODE
}
sub posterize {
- $blurb = 'Posterize the specified drawable.';
-
- $help = <<'HELP';
-This procedures reduces the number of shades allows in each intensity channel
-to the specified 'levels' parameter.
-HELP
-
- &std_pdb_misc;
- $date = '1997';
+ &std_pdb_deprecated ('gimp-drawable-posterize');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -237,14 +196,7 @@ CODE
}
sub desaturate {
- $blurb = 'Desaturate the contents of the specified drawable.';
-
- $help = <<'HELP';
-This procedure desaturates the contents of the specified drawable. This
-procedure only works on drawables of type RGB color.
-HELP
-
- &std_pdb_misc;
+ &std_pdb_deprecated ('gimp-drawable-desaturate');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -278,18 +230,7 @@ CODE
}
sub desaturate_full {
- $blurb = <<'BLURB';
-Desaturate the contents of the specified drawable, with the specified formula.
-BLURB
-
- $help = <<'HELP';
-This procedure desaturates the contents of the specified drawable,
-with the specified formula. This procedure only works on drawables of
-type RGB color.
-HELP
-
- $author = $copyright = 'Karine Delvare';
- $date = '2005';
+ &std_pdb_deprecated ('gimp-drawable-desaturate');
$since = '2.4';
@inargs = (
@@ -326,19 +267,7 @@ CODE
}
sub equalize {
- $blurb = 'Equalize the contents of the specified drawable.';
-
- $help = <<'HELP';
-This procedure equalizes the contents of the specified drawable. Each
-intensity channel is equalized independently. The equalized intensity
-is given as inten' = (255 - inten). The 'mask_only' option specifies
-whether to adjust only the area of the image within the selection
-bounds, or the entire image based on the histogram of the selected
-area. If there is no selection, the entire image is adjusted based on
-the histogram for the entire image.
-HELP
-
- &std_pdb_misc;
+ &std_pdb_deprecated ('gimp-drawable-equalize');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -548,7 +477,7 @@ HELP
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
- GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
+ GObject *config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG,
"range", transfer_mode,
"preserve-luminosity", preserve_lum,
NULL);
@@ -573,14 +502,7 @@ CODE
}
sub colorize {
- $blurb = 'Render the drawable as a grayscale image seen through a colored glass.';
-
- $help = <<'HELP';
-Desaturates the drawable, then tints it with the specified color. This tool is
-only valid on RGB color images. It will not operate on grayscale drawables.
-HELP
-
- &neo_pdb_misc('2004', '2.2');
+ &std_pdb_deprecated ('gimp-drawable-colorize-hsl');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -729,18 +651,7 @@ CODE
}
sub hue_saturation {
- $blurb = <<'BLURB';
-Modify hue, lightness, and saturation in the specified drawable.
-BLURB
-
- $help = <<'HELP';
-This procedure allows the hue, lightness, and saturation in the specified
-drawable to be modified. The 'hue-range' parameter provides the capability to
-limit range of affected hues.
-HELP
-
- &std_pdb_misc;
- $date = '1997';
+ &std_pdb_deprecated ('gimp-drawable-hue-saturation');
@inargs = (
{ name => 'drawable', type => 'drawable',
@@ -786,69 +697,6 @@ CODE
);
}
-sub hue_saturation_overlap {
- $blurb = <<'BLURB';
-Modify hue, lightness, and saturation in the specified drawable.
-BLURB
-
- $help = <<'HELP';
-This procedure allows the hue, lightness, and saturation in the specified
-drawable to be modified. The 'hue-range' parameter provides the capability to
-limit range of affected hues. The 'overlap' parameter provides blending into
-neighboring hue channels when rendering.
-HELP
-
- &joao_pdb_misc('2014', '2.10');
-
- $date = '2014';
-
- @inargs = (
- { name => 'drawable', type => 'drawable',
- desc => 'The drawable' },
- { name => 'hue_range', type => 'enum GimpHueRange',
- desc => 'Range of affected hues' },
- { name => 'hue_offset', type => '-180 <= float <= 180',
- desc => 'Hue offset in degrees' },
- { name => 'lightness', type => '-100 <= float <= 100',
- desc => 'Lightness modification' },
- { name => 'saturation', type => '-100 <= float <= 100',
- desc => 'Saturation modification' },
- { name => 'overlap', type => '0 <= float <= 100',
- desc => 'Overlap other hue channels' }
- );
-
- %invoke = (
- headers => [ qw("operations/gimphuesaturationconfig.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_HUE_SATURATION_CONFIG,
- "range", hue_range,
- NULL);
-
- g_object_set (config,
- "hue", hue_offset / 180.0,
- "saturation", saturation / 100.0,
- "lightness", lightness / 100.0,
- "overlap", overlap / 100.0,
- NULL);
-
- gimp_drawable_apply_operation_by_name (drawable, progress,
- _("Hue-Saturation"),
- "gimp:hue-saturation",
- config);
- g_object_unref (config);
- }
- else
- success = FALSE;
-}
-CODE
- );
-}
-
sub threshold {
$blurb = 'Threshold the specified drawable.';
@@ -916,7 +764,7 @@ CODE
color_balance
colorize
histogram
- hue_saturation hue_saturation_overlap
+ hue_saturation
threshold);
%exports = (app => [ procs], lib => [ procs]);
diff --git a/tools/pdbgen/pdb/drawable_color.pdb b/tools/pdbgen/pdb/drawable_color.pdb
new file mode 100644
index 0000000..13547d9
--- /dev/null
+++ b/tools/pdbgen/pdb/drawable_color.pdb
@@ -0,0 +1,815 @@
+# 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/>.
+
+# "Perlized" from C source by Manish Singh <yosh gimp org>
+
+sub drawable_brightness_contrast {
+ $blurb = 'Modify brightness/contrast in the specified drawable.';
+
+ $help = <<'HELP';
+This procedures allows the brightness and contrast of the specified drawable to
+be modified. Both 'brightness' and 'contrast' parameters are defined between
+-0.5 and 0.5.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'brightness', type => '-0.5 <= float <= 0.5',
+ desc => 'Brightness adjustment' },
+ { name => 'contrast', type => '-0.5 <= float <= 0.5',
+ desc => 'Contrast adjustment' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpbrightnesscontrastconfig.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_BRIGHTNESS_CONTRAST_CONFIG,
+ "brightness", brightness,
+ "contrast", contrast,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Brightness-Contrast"),
+ "gimp:brightness-contrast",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_color_balance {
+ $blurb = 'Modify the color balance of the specified drawable.';
+
+ $help = <<'HELP';
+Modify the color balance of the specified drawable. There are three axis which
+can be modified: cyan-red, magenta-green, and yellow-blue. Negative values
+increase the amount of the former, positive values increase the amount of the
+latter. Color balance can be controlled with the 'transfer_mode' setting, which
+allows shadows, mid-tones, and highlights in an image to be affected
+differently. The 'preserve-lum' parameter, if TRUE, ensures that the
+luminosity of each pixel remains fixed.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'transfer_mode', type => 'enum GimpTransferMode',
+ desc => 'Transfer mode' },
+ { name => 'preserve_lum', type => 'boolean',
+ desc => 'Preserve luminosity values at each pixel' },
+ { name => 'cyan_red', type => '-100 <= float <= 100',
+ desc => 'Cyan-Red color balance' },
+ { name => 'magenta_green', type => '-100 <= float <= 100',
+ desc => 'Magenta-Green color balance' },
+ { name => 'yellow_blue', type => '-100 <= float <= 100',
+ desc => 'Yellow-Blue color balance' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpcolorbalanceconfig.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_COLOR_BALANCE_CONFIG,
+ "range", transfer_mode,
+ "preserve-luminosity", preserve_lum,
+ NULL);
+
+ g_object_set (config,
+ "cyan-red", cyan_red / 100.0,
+ "magenta-green", magenta_green / 100.0,
+ "yellow-blue", yellow_blue / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Color Balance"),
+ "gimp:color-balance",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_colorize_hsl {
+ $blurb = 'Render the drawable as a grayscale image seen through a colored glass.';
+
+ $help = <<'HELP';
+Desaturates the drawable, then tints it with the specified color. This tool is
+only valid on RGB color images. It will not operate on grayscale drawables.
+HELP
+
+ &neo_pdb_misc('2004', '2.10');
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'hue', type => '0 <= float <= 360',
+ desc => 'Hue in degrees' },
+ { name => 'saturation', type => '0 <= float <= 100',
+ desc => 'Saturation in percent' },
+ { name => 'lightness', type => '-100 <= float <= 100',
+ desc => 'Lightness in percent' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpcolorizeconfig.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) &&
+ ! gimp_drawable_is_gray (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
+ "hue", hue / 360.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Colorize"),
+ "gimp:colorize",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_curves_explicit {
+ $blurb = 'Modifies the intensity curve(s) for specified drawable.';
+
+ $help = <<'HELP';
+Modifies the intensity mapping for one channel in the specified drawable. The
+drawable must be either grayscale or RGB, and the channel can be either an
+intensity component, or the value. The 'curve' parameter is an array of bytes
+which explicitly defines how each pixel value in the drawable will be modified.
+Use the gimp_curves_spline() function to modify intensity levels with Catmull
+Rom splines.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'channel', type => 'enum GimpHistogramChannel',
+ desc => 'The channel to modify' },
+ { name => 'curve', type => 'int8array',
+ desc => 'The explicit curve',
+ array => { name => 'num_bytes',
+ desc => 'The number of bytes in the new curve (always
+ 256)' } }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpcurvesconfig.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) &&
+ (num_bytes == 256) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = gimp_curves_config_new_spline (channel,
+ curve,
+ num_bytes);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_curves_spline {
+ $blurb = 'Modifies the intensity curve(s) for specified drawable.';
+
+ $help = <<'HELP';
+Modifies the intensity mapping for one channel in the specified drawable. The
+drawable must be either grayscale or RGB, and the channel can be either an
+intensity component, or the value. The 'control_pts' parameter is an array of
+integers which define a set of control points which describe a Catmull Rom
+spline which yields the final intensity curve. Use the gimp_curves_explicit()
+function to explicitly modify intensity levels.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'channel', type => 'enum GimpHistogramChannel',
+ desc => 'The channel to modify' },
+ { name => 'control_pts', type => 'int8array',
+ desc => 'The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y,
+ ... }',
+ array => { name => 'num_points', type => '4 <= int32 <= 34',
+ desc => 'The number of values in the control point array' }
+ }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpcurvesconfig.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) &&
+ ! (num_points & 1) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = gimp_curves_config_new_spline (channel,
+ control_pts,
+ num_points);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Curves"),
+ "gimp:curves",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_desaturate {
+ $blurb = <<'BLURB';
+Desaturate the contents of the specified drawable, with the specified formula.
+BLURB
+
+ $help = <<'HELP';
+This procedure desaturates the contents of the specified drawable,
+with the specified formula. This procedure only works on drawables of
+type RGB color.
+HELP
+
+ $author = $copyright = 'Karine Delvare';
+ $date = '2005';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'desaturate_mode', type => 'enum GimpDesaturateMode',
+ desc => 'The formula to use to desaturate' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpdesaturateconfig.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) &&
+ gimp_drawable_is_rgb (drawable))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+ "mode", desaturate_mode,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Desaturate"),
+ "gimp:desaturate",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_equalize {
+ $blurb = 'Equalize the contents of the specified drawable.';
+
+ $help = <<'HELP';
+This procedure equalizes the contents of the specified drawable. Each
+intensity channel is equalized independently. The equalized intensity
+is given as inten' = (255 - inten). The 'mask_only' option specifies
+whether to adjust only the area of the image within the selection
+bounds, or the entire image based on the histogram of the selected
+area. If there is no selection, the entire image is adjusted based on
+the histogram for the entire image.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'mask_only', type => 'boolean',
+ desc => 'Equalization option' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpdrawable-equalize.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))
+ success = FALSE;
+
+ if (success)
+ gimp_drawable_equalize (drawable, mask_only);
+}
+CODE
+ );
+}
+
+sub drawable_histogram {
+ $blurb = <<'BLURB';
+Returns information on the intensity histogram for the specified drawable.
+BLURB
+
+ $help = <<'HELP';
+This tool makes it possible to gather information about the intensity
+histogram of a drawable. A channel to examine is first specified. This
+can be either value, red, green, or blue, depending on whether the
+drawable is of type color or grayscale. Second, a range of intensities
+are specified. The gimp_histogram() function returns statistics based
+on the pixels in the drawable that fall under this range of
+values. Mean, standard deviation, median, number of pixels, and
+percentile are all returned. Additionally, the total count of pixels
+in the image is returned. Counts of pixels are weighted by any
+associated alpha values and by the current selection mask. That is,
+pixels that lie outside an active selection mask will not be
+counted. Similarly, pixels with transparent alpha values will not be
+counted. The returned mean, std_dev and median are in the range (0..255)
+for 8-bit images, or if the plug-in is not precision-aware, and in the
+range (0.0..1.0) otherwise.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'channel', type => 'enum GimpHistogramChannel',
+ desc => 'The channel to modify' },
+ { name => 'start_range', type => '0 <= int32 < 256',
+ desc => 'Start of the intensity measurement range' },
+ { name => 'end_range', type => '0 <= int32 < 256',
+ desc => 'End of the intensity measurement range' }
+ );
+
+ @outargs = (
+ { name => 'mean', type => 'float', void_ret => 1,
+ desc => 'Mean intensity value' },
+ { name => 'std_dev', type => 'float',
+ desc => 'Standard deviation of intensity values' },
+ { name => 'median', type => 'float',
+ desc => 'Median intensity value' },
+ { name => 'pixels', type => 'float',
+ desc => 'Alpha-weighted pixel count for entire image' },
+ { name => 'count', type => 'float',
+ desc => 'Alpha-weighted pixel count for range' },
+ { name => 'percentile', type => 'float',
+ desc => 'Percentile that range falls under' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpdrawable-histogram.h"
+ "core/gimphistogram.h") ],
+ code => <<'CODE'
+{
+ if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, 0, error) ||
+ (! gimp_drawable_has_alpha (drawable) &&
+ channel == GIMP_HISTOGRAM_ALPHA) ||
+ (gimp_drawable_is_gray (drawable) &&
+ channel != GIMP_HISTOGRAM_VALUE && channel != GIMP_HISTOGRAM_ALPHA))
+ success = FALSE;
+
+ if (success)
+ {
+ GimpHistogram *histogram = gimp_histogram_new (TRUE);
+ gint start = start_range;
+ gint end = end_range;
+ gint n_bins;
+
+ gimp_drawable_calculate_histogram (drawable, histogram);
+
+ n_bins = gimp_histogram_n_bins (histogram);
+
+ if (n_bins != 256)
+ {
+ start = ROUND ((gdouble) start * (n_bins - 1) / 255);
+ end = ROUND ((gdouble) end * (n_bins - 1) / 255);
+ }
+
+ mean = gimp_histogram_get_mean (histogram, channel,
+ start, end);
+ std_dev = gimp_histogram_get_std_dev (histogram, channel,
+ start, end);
+ median = gimp_histogram_get_median (histogram, channel,
+ start, end);
+ pixels = gimp_histogram_get_count (histogram, channel, 0, n_bins - 1);
+ count = gimp_histogram_get_count (histogram, channel,
+ start, end);
+ percentile = count / pixels;
+
+ g_object_unref (histogram);
+
+ if (n_bins == 256 ||
+ ! gimp->plug_in_manager->current_plug_in ||
+ ! gimp_plug_in_precision_enabled (gimp->plug_in_manager->current_plug_in))
+ {
+ mean *= 255;
+ std_dev *= 255;
+ median *= 255;
+ }
+ }
+}
+CODE
+ );
+}
+
+sub drawable_hue_saturation {
+ $blurb = <<'BLURB';
+Modify hue, lightness, and saturation in the specified drawable.
+BLURB
+
+ $help = <<'HELP';
+This procedure allows the hue, lightness, and saturation in the specified
+drawable to be modified. The 'hue-range' parameter provides the capability to
+limit range of affected hues. The 'overlap' parameter provides blending into
+neighboring hue channels when rendering.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'hue_range', type => 'enum GimpHueRange',
+ desc => 'Range of affected hues' },
+ { name => 'hue_offset', type => '-180 <= float <= 180',
+ desc => 'Hue offset in degrees' },
+ { name => 'lightness', type => '-100 <= float <= 100',
+ desc => 'Lightness modification' },
+ { name => 'saturation', type => '-100 <= float <= 100',
+ desc => 'Saturation modification' },
+ { name => 'overlap', type => '0 <= float <= 100',
+ desc => 'Overlap other hue channels' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimphuesaturationconfig.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_HUE_SATURATION_CONFIG,
+ "range", hue_range,
+ NULL);
+
+ g_object_set (config,
+ "hue", hue_offset / 180.0,
+ "saturation", saturation / 100.0,
+ "lightness", lightness / 100.0,
+ "overlap", overlap / 100.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Hue-Saturation"),
+ "gimp:hue-saturation",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_invert {
+ $blurb = 'Invert the contents of the specified drawable.';
+
+ $help = <<'HELP';
+This procedure inverts the contents of the specified drawable. Each intensity
+channel is inverted independently. The inverted intensity is given as inten' =
+(255 - inten).
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' }
+ );
+
+ %invoke = (
+ 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))
+ {
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Invert"),
+ "gegl:invert-gamma",
+ NULL);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_levels {
+ $blurb = 'Modifies intensity levels in the specified drawable.';
+
+ $help = <<'HELP';
+This tool allows intensity levels in the specified drawable to be remapped
+according to a set of parameters. The low/high input levels specify an initial
+mapping from the source intensities. The gamma value determines how intensities
+between the low and high input intensities are interpolated. A gamma value of
+1.0 results in a linear interpolation. Higher gamma values result in more
+high-level intensities. Lower gamma values result in more low-level
+intensities. The low/high output levels constrain the final intensity
+mapping--that is, no final intensity will be lower than the low output level
+and no final intensity will be higher than the high output level. This tool is
+only valid on RGB color and grayscale images.
+HELP
+
+ &std_pdb_misc;
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'channel', type => 'enum GimpHistogramChannel',
+ desc => 'The channel to modify' },
+ { name => 'low_input', type => '0.0 <= float <= 1.0',
+ desc => "Intensity of lowest input" },
+ { name => 'high_input', type => '0.0 <= float <= 1.0',
+ desc => "Intensity of highest input" },
+ { name => 'gamma', type => '0.1 <= float <= 10',
+ desc => 'Gamma correction factor' },
+ { name => 'low_output', type => '0.0 <= float <= 1.0',
+ desc => "Intensity of lowest output" },
+ { name => 'high_output', type => '0.0 <= float <= 1.0',
+ desc => "Intensity of highest output" }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimplevelsconfig.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) &&
+ (gimp_drawable_has_alpha (drawable) || channel != GIMP_HISTOGRAM_ALPHA) &&
+ (! gimp_drawable_is_gray (drawable) ||
+ channel == GIMP_HISTOGRAM_VALUE || channel == GIMP_HISTOGRAM_ALPHA))
+ {
+ GObject *config = g_object_new (GIMP_TYPE_LEVELS_CONFIG,
+ "channel", channel,
+ NULL);
+
+ g_object_set (config,
+ "low-input", low_input,
+ "high-input", high_input,
+ "gamma", gamma,
+ "low-output", low_output,
+ "high-output", high_output,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ C_("undo-type", "Levels"),
+ "gimp:levels",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = TRUE;
+}
+CODE
+ );
+}
+
+sub drawable_levels_stretch {
+ $blurb = 'Automatically modifies intensity levels in the specified drawable.';
+
+ $help = <<'HELP';
+This procedure allows intensity levels in the specified drawable to be
+remapped according to a set of guessed parameters. It is equivalent to
+clicking the "Auto" button in the Levels tool.
+HELP
+
+ $author = $copyright = 'Joao S.O. Bueno, Shawn Willden';
+ $date = '2003';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpdrawable-levels.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))
+ {
+ gimp_drawable_levels_stretch (drawable, progress);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_posterize {
+ $blurb = 'Posterize the specified drawable.';
+
+ $help = <<'HELP';
+This procedures reduces the number of shades allows in each intensity channel
+to the specified 'levels' parameter.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'levels', type => '2 <= int32 <= 255',
+ desc => 'Levels of posterization' }
+ );
+
+ %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);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Posterize"),
+ "gimp:posterize",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub drawable_threshold {
+ $blurb = 'Threshold the specified drawable.';
+
+ $help = <<'HELP';
+This procedures generates a threshold map of the specified drawable. All pixels
+between the values of 'low_threshold' and 'high_threshold' are replaced with
+white, and all other pixels with black.
+HELP
+
+ &std_pdb_misc;
+ $date = '1997';
+ $since = '2.10';
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' },
+ { name => 'low_threshold', type => '0 <= int32 <= 255',
+ desc => 'The low threshold value' },
+ { name => 'high_threshold', type => '0 <= int32 <= 255',
+ desc => 'The high threshold value' }
+ );
+
+ %invoke = (
+ headers => [ qw("operations/gimpthresholdconfig.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_THRESHOLD_CONFIG,
+ "low", low_threshold / 255.0,
+ "high", high_threshold / 255.0,
+ NULL);
+
+ gimp_drawable_apply_operation_by_name (drawable, progress,
+ _("Threshold"),
+ "gimp:threshold",
+ config);
+ g_object_unref (config);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+
+ headers = qw("libgimpmath/gimpmath.h"
+ "core/gimp.h"
+ "core/gimpdrawable.h"
+ "core/gimpdrawable-operation.h"
+ "plug-in/gimpplugin.h"
+ "plug-in/gimppluginmanager.h"
+ "gimppdb-utils.h"
+ "gimp-intl.h");
+
+ procs = qw(drawable_brightness_contrast
+ drawable_color_balance
+ drawable_colorize_hsl
+ drawable_curves_explicit drawable_curves_spline
+ drawable_desaturate
+ drawable_equalize
+ drawable_histogram
+ drawable_hue_saturation
+ drawable_invert
+ drawable_levels drawable_levels_stretch
+ drawable_posterize
+ drawable_threshold);
+
+%exports = (app => [ procs], lib => [ procs]);
+
+$desc = 'Color';
+$doc_title = 'gimpdrawablecolor';
+$doc_short_desc = "Functions for manipulating a drawable's color.";
+$doc_long_desc = "Functions for manipulating a drawable's color, including curves and histograms.";
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]