2014-01-13 05:11:15 +08:00
|
|
|
/* 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
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2014-01-13 05:11:15 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpdrawablecolor
|
2014-01-13 05:11:15 +08:00
|
|
|
* @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:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: 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
|
2022-03-27 04:11:49 +08:00
|
|
|
* are defined between -1.0 and 1.0.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_brightness_contrast (GimpDrawable *drawable,
|
|
|
|
gdouble brightness,
|
|
|
|
gdouble contrast)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_DOUBLE, brightness,
|
|
|
|
G_TYPE_DOUBLE, contrast,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-brightness-contrast",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_color_balance:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_color_balance (GimpDrawable *drawable,
|
|
|
|
GimpTransferMode transfer_mode,
|
|
|
|
gboolean preserve_lum,
|
|
|
|
gdouble cyan_red,
|
|
|
|
gdouble magenta_green,
|
|
|
|
gdouble yellow_blue)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_TRANSFER_MODE, transfer_mode,
|
|
|
|
G_TYPE_BOOLEAN, preserve_lum,
|
|
|
|
G_TYPE_DOUBLE, cyan_red,
|
|
|
|
G_TYPE_DOUBLE, magenta_green,
|
|
|
|
G_TYPE_DOUBLE, yellow_blue,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-color-balance",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_colorize_hsl:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_colorize_hsl (GimpDrawable *drawable,
|
|
|
|
gdouble hue,
|
|
|
|
gdouble saturation,
|
|
|
|
gdouble lightness)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_DOUBLE, hue,
|
|
|
|
G_TYPE_DOUBLE, saturation,
|
|
|
|
G_TYPE_DOUBLE, lightness,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-colorize-hsl",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_curves_explicit:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable.
|
2014-01-13 05:11:15 +08:00
|
|
|
* @channel: The channel to modify.
|
2014-06-18 04:37:46 +08:00
|
|
|
* @num_values: The number of values in the new curve.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @values: (array length=num_values) (element-type gdouble): The explicit curve.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* Modifies the intensity curve(s) for specified drawable.
|
|
|
|
*
|
|
|
|
* Modifies the intensity mapping for one channel in the specified
|
2014-06-18 04:37:46 +08:00
|
|
|
* drawable. The channel can be either an intensity component, or the
|
|
|
|
* value. The 'values' parameter is an array of doubles which
|
|
|
|
* explicitly defines how each pixel value in the drawable will be
|
2020-10-26 19:35:17 +08:00
|
|
|
* modified. Use the gimp_drawable_curves_spline() function to modify
|
|
|
|
* intensity levels with Catmull Rom splines.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2014-01-13 05:11:15 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_drawable_curves_explicit (GimpDrawable *drawable,
|
2014-01-13 05:11:15 +08:00
|
|
|
GimpHistogramChannel channel,
|
2014-06-18 04:37:46 +08:00
|
|
|
gint num_values,
|
|
|
|
const gdouble *values)
|
2014-01-13 05:11:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2014-01-13 05:11:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-13 19:59:33 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
|
|
|
|
G_TYPE_INT, num_values,
|
|
|
|
GIMP_TYPE_FLOAT_ARRAY, NULL,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_float_array (gimp_value_array_index (args, 3), values, num_values);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-curves-explicit",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_curves_spline:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable.
|
2014-01-13 05:11:15 +08:00
|
|
|
* @channel: The channel to modify.
|
|
|
|
* @num_points: The number of values in the control point array.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @points: (array length=num_points) (element-type gdouble): The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* Modifies the intensity curve(s) for specified drawable.
|
|
|
|
*
|
|
|
|
* Modifies the intensity mapping for one channel in the specified
|
2014-06-18 04:37:46 +08:00
|
|
|
* drawable. The channel can be either an intensity component, or the
|
|
|
|
* value. The 'points' parameter is an array of doubles which define a
|
|
|
|
* set of control points which describe a Catmull Rom spline which
|
2020-10-26 19:35:17 +08:00
|
|
|
* yields the final intensity curve. Use the
|
|
|
|
* gimp_drawable_curves_explicit() function to explicitly modify
|
|
|
|
* intensity levels.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2014-01-13 05:11:15 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_drawable_curves_spline (GimpDrawable *drawable,
|
2014-01-13 05:11:15 +08:00
|
|
|
GimpHistogramChannel channel,
|
|
|
|
gint num_points,
|
2014-06-18 04:37:46 +08:00
|
|
|
const gdouble *points)
|
2014-01-13 05:11:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2014-01-13 05:11:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, num_points,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_FLOAT_ARRAY, NULL,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_float_array (gimp_value_array_index (args, 3), points, num_points);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-curves-spline",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2021-05-12 18:08:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_extract_component:
|
|
|
|
* @drawable: The drawable.
|
2023-02-15 00:12:31 +08:00
|
|
|
* @component: Component (RGB Red (0), RGB Green (1), RGB Blue (2), Hue (3), HSV Saturation (4), HSV Value (5), HSL Saturation (6), HSL Lightness (7), CMYK Cyan (8), CMYK Magenta (9), CMYK Yellow (10), CMYK Key (11), Y'CbCr Y' (12), Y'CbCr Cb (13), Y'CbCr Cr (14), LAB L (15), LAB A (16), LAB B (17), LCH C(ab) (18), LCH H(ab) (19), Alpha (20)).
|
2021-05-12 18:08:02 +08:00
|
|
|
* @invert: Invert the extracted component.
|
|
|
|
* @linear: Use linear output instead of gamma corrected.
|
|
|
|
*
|
|
|
|
* Extract a color model component.
|
|
|
|
*
|
|
|
|
* Extract a color model component.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2023-02-15 00:12:31 +08:00
|
|
|
*
|
|
|
|
* Since: 2.10.34
|
2021-05-12 18:08:02 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_extract_component (GimpDrawable *drawable,
|
|
|
|
gint component,
|
|
|
|
gboolean invert,
|
|
|
|
gboolean linear)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
|
|
|
G_TYPE_INT, component,
|
|
|
|
G_TYPE_BOOLEAN, invert,
|
|
|
|
G_TYPE_BOOLEAN, linear,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-extract-component",
|
|
|
|
args);
|
2021-05-12 18:08:02 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
2019-08-13 19:59:33 +08:00
|
|
|
* gimp_drawable_desaturate:
|
|
|
|
* @drawable: The drawable.
|
|
|
|
* @desaturate_mode: The formula to use to desaturate.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
2019-08-13 19:59:33 +08:00
|
|
|
* Desaturate the contents of the specified drawable, with the
|
|
|
|
* specified formula.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
2019-08-13 19:59:33 +08:00
|
|
|
* This procedure desaturates the contents of the specified drawable,
|
|
|
|
* with the specified formula. This procedure only works on drawables
|
|
|
|
* of type RGB color.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2014-01-13 05:11:15 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_drawable_desaturate (GimpDrawable *drawable,
|
|
|
|
GimpDesaturateMode desaturate_mode)
|
2014-01-13 05:11:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2014-01-13 05:11:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_DESATURATE_MODE, desaturate_mode,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-desaturate",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2019-08-13 19:59:33 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_equalize:
|
|
|
|
* @drawable: 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_equalize (GimpDrawable *drawable,
|
|
|
|
gboolean mask_only)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_BOOLEAN, mask_only,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-equalize",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_drawable_histogram:
|
|
|
|
* @drawable: The drawable.
|
|
|
|
* @channel: The channel to query.
|
|
|
|
* @start_range: Start of the intensity measurement range.
|
|
|
|
* @end_range: End of the intensity measurement range.
|
|
|
|
* @mean: (out): Mean intensity value.
|
|
|
|
* @std_dev: (out): Standard deviation of intensity values.
|
|
|
|
* @median: (out): Median intensity value.
|
|
|
|
* @pixels: (out): Alpha-weighted pixel count for entire image.
|
|
|
|
* @count: (out): Alpha-weighted pixel count for range.
|
|
|
|
* @percentile: (out): Percentile that range falls under.
|
|
|
|
*
|
|
|
|
* Returns information on the intensity histogram for the specified
|
|
|
|
* drawable.
|
2014-01-13 05:11:15 +08:00
|
|
|
*
|
|
|
|
* 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
|
2016-11-02 03:46:31 +08:00
|
|
|
* range of intensities are specified. The gimp_drawable_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
|
2014-01-13 05:11:15 +08:00
|
|
|
* 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
|
2016-11-02 03:46:31 +08:00
|
|
|
* range (0..255) for 8-bit images or if the plug-in is not
|
2014-01-13 05:11:15 +08:00
|
|
|
* precision-aware, and in the range (0.0..1.0) otherwise.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2014-01-13 05:11:15 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_drawable_histogram (GimpDrawable *drawable,
|
2014-01-13 05:11:15 +08:00
|
|
|
GimpHistogramChannel channel,
|
2016-11-02 03:46:31 +08:00
|
|
|
gdouble start_range,
|
|
|
|
gdouble end_range,
|
2014-01-13 05:11:15 +08:00
|
|
|
gdouble *mean,
|
|
|
|
gdouble *std_dev,
|
|
|
|
gdouble *median,
|
|
|
|
gdouble *pixels,
|
|
|
|
gdouble *count,
|
|
|
|
gdouble *percentile)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2014-01-13 05:11:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-13 19:59:33 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
|
|
|
|
G_TYPE_DOUBLE, start_range,
|
|
|
|
G_TYPE_DOUBLE, end_range,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-histogram",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
*mean = 0.0;
|
|
|
|
*std_dev = 0.0;
|
|
|
|
*median = 0.0;
|
|
|
|
*pixels = 0.0;
|
|
|
|
*count = 0.0;
|
|
|
|
*percentile = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
2019-09-03 19:31:27 +08:00
|
|
|
if (success)
|
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*mean = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
|
|
|
*std_dev = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
|
|
|
|
*median = GIMP_VALUES_GET_DOUBLE (return_vals, 3);
|
|
|
|
*pixels = GIMP_VALUES_GET_DOUBLE (return_vals, 4);
|
|
|
|
*count = GIMP_VALUES_GET_DOUBLE (return_vals, 5);
|
|
|
|
*percentile = GIMP_VALUES_GET_DOUBLE (return_vals, 6);
|
2019-09-03 19:31:27 +08:00
|
|
|
}
|
|
|
|
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-09-03 19:31:27 +08:00
|
|
|
* gimp_drawable_hue_saturation:
|
|
|
|
* @drawable: The drawable.
|
2014-01-13 05:11:15 +08:00
|
|
|
* @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.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2014-01-13 05:11:15 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-09-03 19:31:27 +08:00
|
|
|
gimp_drawable_hue_saturation (GimpDrawable *drawable,
|
|
|
|
GimpHueRange hue_range,
|
|
|
|
gdouble hue_offset,
|
|
|
|
gdouble lightness,
|
|
|
|
gdouble saturation,
|
|
|
|
gdouble overlap)
|
2014-01-13 05:11:15 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2014-01-13 05:11:15 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-09-03 19:31:27 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_HUE_RANGE, hue_range,
|
|
|
|
G_TYPE_DOUBLE, hue_offset,
|
|
|
|
G_TYPE_DOUBLE, lightness,
|
|
|
|
G_TYPE_DOUBLE, saturation,
|
|
|
|
G_TYPE_DOUBLE, overlap,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-hue-saturation",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2014-01-13 05:11:15 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-04 03:28:47 +08:00
|
|
|
* gimp_drawable_invert:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable.
|
|
|
|
* @linear: Whether to invert in linear space.
|
|
|
|
*
|
|
|
|
* 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). If 'linear' is TRUE, the
|
|
|
|
* drawable is inverted in linear space.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_invert (GimpDrawable *drawable,
|
|
|
|
gboolean linear)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_BOOLEAN, linear,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-invert",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_levels:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable.
|
|
|
|
* @channel: The channel to modify.
|
|
|
|
* @low_input: Intensity of lowest input.
|
|
|
|
* @high_input: Intensity of highest input.
|
|
|
|
* @clamp_input: Clamp input values before applying output levels.
|
|
|
|
* @gamma: Gamma adjustment factor.
|
|
|
|
* @low_output: Intensity of lowest output.
|
|
|
|
* @high_output: Intensity of highest output.
|
|
|
|
* @clamp_output: Clamp final output values.
|
|
|
|
*
|
|
|
|
* 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_levels (GimpDrawable *drawable,
|
|
|
|
GimpHistogramChannel channel,
|
|
|
|
gdouble low_input,
|
|
|
|
gdouble high_input,
|
|
|
|
gboolean clamp_input,
|
|
|
|
gdouble gamma,
|
|
|
|
gdouble low_output,
|
|
|
|
gdouble high_output,
|
|
|
|
gboolean clamp_output)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
|
|
|
|
G_TYPE_DOUBLE, low_input,
|
|
|
|
G_TYPE_DOUBLE, high_input,
|
|
|
|
G_TYPE_BOOLEAN, clamp_input,
|
|
|
|
G_TYPE_DOUBLE, gamma,
|
|
|
|
G_TYPE_DOUBLE, low_output,
|
|
|
|
G_TYPE_DOUBLE, high_output,
|
|
|
|
G_TYPE_BOOLEAN, clamp_output,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-levels",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_levels_stretch:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_levels_stretch (GimpDrawable *drawable)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-levels-stretch",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2021-05-12 20:09:25 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_shadows_highlights:
|
|
|
|
* @drawable: The drawable.
|
|
|
|
* @shadows: Adjust exposure of shadows.
|
|
|
|
* @highlights: Adjust exposure of highlights.
|
|
|
|
* @whitepoint: Shift white point.
|
|
|
|
* @radius: Spatial extent.
|
|
|
|
* @compress: Compress the effect on shadows/highlights and preserve midtones.
|
|
|
|
* @shadows_ccorrect: Adjust saturation of shadows.
|
|
|
|
* @highlights_ccorrect: Adjust saturation of highlights.
|
|
|
|
*
|
|
|
|
* Perform shadows and highlights correction.
|
|
|
|
*
|
|
|
|
* This filter allows adjusting shadows and highlights in the image
|
|
|
|
* separately. The implementation closely follow its counterpart in the
|
|
|
|
* Darktable photography software.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2023-02-15 00:12:31 +08:00
|
|
|
* Since: 2.10.34
|
2021-05-12 20:09:25 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_shadows_highlights (GimpDrawable *drawable,
|
|
|
|
gdouble shadows,
|
|
|
|
gdouble highlights,
|
|
|
|
gdouble whitepoint,
|
|
|
|
gdouble radius,
|
|
|
|
gdouble compress,
|
|
|
|
gdouble shadows_ccorrect,
|
|
|
|
gdouble highlights_ccorrect)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
|
|
|
G_TYPE_DOUBLE, shadows,
|
|
|
|
G_TYPE_DOUBLE, highlights,
|
|
|
|
G_TYPE_DOUBLE, whitepoint,
|
|
|
|
G_TYPE_DOUBLE, radius,
|
|
|
|
G_TYPE_DOUBLE, compress,
|
|
|
|
G_TYPE_DOUBLE, shadows_ccorrect,
|
|
|
|
G_TYPE_DOUBLE, highlights_ccorrect,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-shadows-highlights",
|
|
|
|
args);
|
2021-05-12 20:09:25 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_posterize:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: 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: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_posterize (GimpDrawable *drawable,
|
|
|
|
gint levels)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_INT, levels,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-posterize",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2014-01-13 05:11:15 +08:00
|
|
|
/**
|
|
|
|
* gimp_drawable_threshold:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable.
|
|
|
|
* @channel: The channel to base the threshold on.
|
|
|
|
* @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', on the scale of 'channel' are replaced with white,
|
|
|
|
* and all other pixels with black.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_drawable_threshold (GimpDrawable *drawable,
|
|
|
|
GimpHistogramChannel channel,
|
|
|
|
gdouble low_threshold,
|
|
|
|
gdouble high_threshold)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
|
|
|
|
G_TYPE_DOUBLE, low_threshold,
|
|
|
|
G_TYPE_DOUBLE, high_threshold,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-drawable-threshold",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|