PIKApp/app/pdb/drawable-color-cmds.c

1548 lines
78 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* 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 <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl. */
#include "config.h"
#include "stamp-pdbgen.h"
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libpikamath/pikamath.h"
#include "libpikabase/pikabase.h"
#include "pdb-types.h"
#include "core/pika.h"
#include "core/pikadrawable-equalize.h"
#include "core/pikadrawable-histogram.h"
#include "core/pikadrawable-levels.h"
#include "core/pikadrawable-operation.h"
#include "core/pikadrawable.h"
#include "core/pikahistogram.h"
#include "core/pikaparamspecs.h"
#include "operations/pikabrightnesscontrastconfig.h"
#include "operations/pikacolorbalanceconfig.h"
#include "operations/pikacurvesconfig.h"
#include "operations/pikahuesaturationconfig.h"
#include "operations/pikalevelsconfig.h"
#include "pikapdb.h"
#include "pikapdb-utils.h"
#include "pikaprocedure.h"
#include "internal-procs.h"
#include "pika-intl.h"
static PikaValueArray *
drawable_brightness_contrast_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gdouble brightness;
gdouble contrast;
drawable = g_value_get_object (pika_value_array_index (args, 0));
brightness = g_value_get_double (pika_value_array_index (args, 1));
contrast = g_value_get_double (pika_value_array_index (args, 2));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GObject *config = g_object_new (PIKA_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
"brightness", brightness,
"contrast", contrast,
NULL);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Brightness-Contrast"),
"pika:brightness-contrast",
config);
g_object_unref (config);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_color_balance_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint transfer_mode;
gboolean preserve_lum;
gdouble cyan_red;
gdouble magenta_green;
gdouble yellow_blue;
drawable = g_value_get_object (pika_value_array_index (args, 0));
transfer_mode = g_value_get_enum (pika_value_array_index (args, 1));
preserve_lum = g_value_get_boolean (pika_value_array_index (args, 2));
cyan_red = g_value_get_double (pika_value_array_index (args, 3));
magenta_green = g_value_get_double (pika_value_array_index (args, 4));
yellow_blue = g_value_get_double (pika_value_array_index (args, 5));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GObject *config = g_object_new (PIKA_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);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Color Balance"),
"pika:color-balance",
config);
g_object_unref (config);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_colorize_hsl_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gdouble hue;
gdouble saturation;
gdouble lightness;
drawable = g_value_get_object (pika_value_array_index (args, 0));
hue = g_value_get_double (pika_value_array_index (args, 1));
saturation = g_value_get_double (pika_value_array_index (args, 2));
lightness = g_value_get_double (pika_value_array_index (args, 3));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
! pika_drawable_is_gray (drawable))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "pika:colorize",
"hue", hue / 360.0,
"saturation", saturation / 100.0,
"lightness", lightness / 100.0,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Colorize"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_curves_explicit_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint channel;
gint num_values;
const gdouble *values;
drawable = g_value_get_object (pika_value_array_index (args, 0));
channel = g_value_get_enum (pika_value_array_index (args, 1));
num_values = g_value_get_int (pika_value_array_index (args, 2));
values = pika_value_get_float_array (pika_value_array_index (args, 3));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
(num_values >= 256) &&
(num_values <= 4096) &&
(pika_drawable_has_alpha (drawable) || channel != PIKA_HISTOGRAM_ALPHA) &&
(! pika_drawable_is_gray (drawable) ||
channel == PIKA_HISTOGRAM_VALUE || channel == PIKA_HISTOGRAM_ALPHA) &&
channel != PIKA_HISTOGRAM_LUMINANCE)
{
GObject *config = pika_curves_config_new_explicit (channel,
values,
num_values);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Curves"),
"pika:curves",
config);
g_object_unref (config);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_curves_spline_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint channel;
gint num_points;
const gdouble *points;
drawable = g_value_get_object (pika_value_array_index (args, 0));
channel = g_value_get_enum (pika_value_array_index (args, 1));
num_points = g_value_get_int (pika_value_array_index (args, 2));
points = pika_value_get_float_array (pika_value_array_index (args, 3));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
! (num_points & 1) &&
(pika_drawable_has_alpha (drawable) || channel != PIKA_HISTOGRAM_ALPHA) &&
(! pika_drawable_is_gray (drawable) ||
channel == PIKA_HISTOGRAM_VALUE || channel == PIKA_HISTOGRAM_ALPHA) &&
channel != PIKA_HISTOGRAM_LUMINANCE)
{
GObject *config = pika_curves_config_new_spline (channel,
points,
num_points / 2);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Curves"),
"pika:curves",
config);
g_object_unref (config);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_extract_component_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint component;
gboolean invert;
gboolean linear;
drawable = g_value_get_object (pika_value_array_index (args, 0));
component = g_value_get_int (pika_value_array_index (args, 1));
invert = g_value_get_boolean (pika_value_array_index (args, 2));
linear = g_value_get_boolean (pika_value_array_index (args, 3));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
pika_drawable_is_rgb (drawable))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "gegl:component-extract",
"component", component,
"invert", invert,
"linear", linear,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Extract Component"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_desaturate_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint desaturate_mode;
drawable = g_value_get_object (pika_value_array_index (args, 0));
desaturate_mode = g_value_get_enum (pika_value_array_index (args, 1));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
pika_drawable_is_rgb (drawable))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "pika:desaturate",
"mode", desaturate_mode,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Desaturate"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_equalize_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gboolean mask_only;
drawable = g_value_get_object (pika_value_array_index (args, 0));
mask_only = g_value_get_boolean (pika_value_array_index (args, 1));
if (success)
{
if (! pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) ||
! pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
success = FALSE;
if (success)
pika_drawable_equalize (drawable, mask_only);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_histogram_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaDrawable *drawable;
gint channel;
gdouble start_range;
gdouble 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 = g_value_get_object (pika_value_array_index (args, 0));
channel = g_value_get_enum (pika_value_array_index (args, 1));
start_range = g_value_get_double (pika_value_array_index (args, 2));
end_range = g_value_get_double (pika_value_array_index (args, 3));
if (success)
{
if (! pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL, 0, error) ||
(! pika_drawable_has_alpha (drawable) &&
channel == PIKA_HISTOGRAM_ALPHA) ||
(pika_drawable_is_gray (drawable) &&
channel != PIKA_HISTOGRAM_VALUE && channel != PIKA_HISTOGRAM_ALPHA))
success = FALSE;
if (success)
{
PikaHistogram *histogram;
gint n_bins;
gint start;
PikaTRCType trc;
gint end;
trc = pika_drawable_get_trc (drawable);
histogram = pika_histogram_new (trc);
pika_drawable_calculate_histogram (drawable, histogram, FALSE);
n_bins = pika_histogram_n_bins (histogram);
start = ROUND (start_range * (n_bins - 1));
end = ROUND (end_range * (n_bins - 1));
mean = pika_histogram_get_mean (histogram, channel,
start, end);
std_dev = pika_histogram_get_std_dev (histogram, channel,
start, end);
median = pika_histogram_get_median (histogram, channel,
start, end);
pixels = pika_histogram_get_count (histogram, channel, 0, n_bins - 1);
count = pika_histogram_get_count (histogram, channel,
start, end);
percentile = count / pixels;
g_object_unref (histogram);
if (n_bins == 256)
{
mean *= 255;
std_dev *= 255;
median *= 255;
}
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_double (pika_value_array_index (return_vals, 1), mean);
g_value_set_double (pika_value_array_index (return_vals, 2), std_dev);
g_value_set_double (pika_value_array_index (return_vals, 3), median);
g_value_set_double (pika_value_array_index (return_vals, 4), pixels);
g_value_set_double (pika_value_array_index (return_vals, 5), count);
g_value_set_double (pika_value_array_index (return_vals, 6), percentile);
}
return return_vals;
}
static PikaValueArray *
drawable_hue_saturation_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint hue_range;
gdouble hue_offset;
gdouble lightness;
gdouble saturation;
gdouble overlap;
drawable = g_value_get_object (pika_value_array_index (args, 0));
hue_range = g_value_get_enum (pika_value_array_index (args, 1));
hue_offset = g_value_get_double (pika_value_array_index (args, 2));
lightness = g_value_get_double (pika_value_array_index (args, 3));
saturation = g_value_get_double (pika_value_array_index (args, 4));
overlap = g_value_get_double (pika_value_array_index (args, 5));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GObject *config = g_object_new (PIKA_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);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Hue-Saturation"),
"pika:hue-saturation",
config);
g_object_unref (config);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_invert_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gboolean linear;
drawable = g_value_get_object (pika_value_array_index (args, 0));
linear = g_value_get_boolean (pika_value_array_index (args, 1));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Invert"),
linear ?
"gegl:invert-linear" :
"gegl:invert-gamma",
NULL);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_levels_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint channel;
gdouble low_input;
gdouble high_input;
gboolean clamp_input;
gdouble gamma;
gdouble low_output;
gdouble high_output;
gboolean clamp_output;
drawable = g_value_get_object (pika_value_array_index (args, 0));
channel = g_value_get_enum (pika_value_array_index (args, 1));
low_input = g_value_get_double (pika_value_array_index (args, 2));
high_input = g_value_get_double (pika_value_array_index (args, 3));
clamp_input = g_value_get_boolean (pika_value_array_index (args, 4));
gamma = g_value_get_double (pika_value_array_index (args, 5));
low_output = g_value_get_double (pika_value_array_index (args, 6));
high_output = g_value_get_double (pika_value_array_index (args, 7));
clamp_output = g_value_get_boolean (pika_value_array_index (args, 8));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error) &&
(pika_drawable_has_alpha (drawable) || channel != PIKA_HISTOGRAM_ALPHA) &&
(! pika_drawable_is_gray (drawable) ||
channel == PIKA_HISTOGRAM_VALUE || channel == PIKA_HISTOGRAM_ALPHA) &&
channel != PIKA_HISTOGRAM_LUMINANCE)
{
GObject *config = g_object_new (PIKA_TYPE_LEVELS_CONFIG,
"channel", channel,
NULL);
g_object_set (config,
"low-input", low_input,
"high-input", high_input,
"clamp-input", clamp_input,
"gamma", gamma,
"low-output", low_output,
"high-output", high_output,
"clamp-output", clamp_output,
NULL);
pika_drawable_apply_operation_by_name (drawable, progress,
C_("undo-type", "Levels"),
"pika:levels",
config);
g_object_unref (config);
}
else
success = TRUE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_levels_stretch_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
drawable = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
pika_drawable_levels_stretch (drawable, progress);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_shadows_highlights_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gdouble shadows;
gdouble highlights;
gdouble whitepoint;
gdouble radius;
gdouble compress;
gdouble shadows_ccorrect;
gdouble highlights_ccorrect;
drawable = g_value_get_object (pika_value_array_index (args, 0));
shadows = g_value_get_double (pika_value_array_index (args, 1));
highlights = g_value_get_double (pika_value_array_index (args, 2));
whitepoint = g_value_get_double (pika_value_array_index (args, 3));
radius = g_value_get_double (pika_value_array_index (args, 4));
compress = g_value_get_double (pika_value_array_index (args, 5));
shadows_ccorrect = g_value_get_double (pika_value_array_index (args, 6));
highlights_ccorrect = g_value_get_double (pika_value_array_index (args, 7));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GeglNode *node;
node = gegl_node_new_child (NULL,
"operation", "gegl:shadows-highlights",
"shadows", shadows,
"highlights", highlights,
"whitepoint", whitepoint,
"radius", radius,
"compress", compress,
"shadows-ccorrect", shadows_ccorrect,
"highlights-ccorrect", highlights_ccorrect,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Shadows-Highlights"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_posterize_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint levels;
drawable = g_value_get_object (pika_value_array_index (args, 0));
levels = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "pika:posterize",
"levels", levels,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Posterize"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
drawable_threshold_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaDrawable *drawable;
gint channel;
gdouble low_threshold;
gdouble high_threshold;
drawable = g_value_get_object (pika_value_array_index (args, 0));
channel = g_value_get_enum (pika_value_array_index (args, 1));
low_threshold = g_value_get_double (pika_value_array_index (args, 2));
high_threshold = g_value_get_double (pika_value_array_index (args, 3));
if (success)
{
if (pika_pdb_item_is_attached (PIKA_ITEM (drawable), NULL,
PIKA_PDB_ITEM_CONTENT, error) &&
pika_pdb_item_is_not_group (PIKA_ITEM (drawable), error))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "pika:threshold",
"channel", channel,
"low", low_threshold,
"high", high_threshold,
NULL);
pika_drawable_apply_operation (drawable, progress,
C_("undo-type", "Threshold"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_drawable_color_procs (PikaPDB *pdb)
{
PikaProcedure *procedure;
/*
* pika-drawable-brightness-contrast
*/
procedure = pika_procedure_new (drawable_brightness_contrast_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-brightness-contrast");
pika_procedure_set_static_help (procedure,
"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 -1.0 and 1.0.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("brightness",
"brightness",
"Brightness adjustment",
-1.0, 1.0, -1.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("contrast",
"contrast",
"Contrast adjustment",
-1.0, 1.0, -1.0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-color-balance
*/
procedure = pika_procedure_new (drawable_color_balance_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-color-balance");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("transfer-mode",
"transfer mode",
"Transfer mode",
PIKA_TYPE_TRANSFER_MODE,
PIKA_TRANSFER_SHADOWS,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("preserve-lum",
"preserve lum",
"Preserve luminosity values at each pixel",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("cyan-red",
"cyan red",
"Cyan-Red color balance",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("magenta-green",
"magenta green",
"Magenta-Green color balance",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("yellow-blue",
"yellow blue",
"Yellow-Blue color balance",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-colorize-hsl
*/
procedure = pika_procedure_new (drawable_colorize_hsl_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-colorize-hsl");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2004");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("hue",
"hue",
"Hue in degrees",
0, 360, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("saturation",
"saturation",
"Saturation in percent",
0, 100, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("lightness",
"lightness",
"Lightness in percent",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-curves-explicit
*/
procedure = pika_procedure_new (drawable_curves_explicit_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-curves-explicit");
pika_procedure_set_static_help (procedure,
"Modifies the intensity curve(s) for specified drawable.",
"Modifies the intensity mapping for one channel in the specified 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 modified. Use the 'pika-drawable-curves-spline' function to modify intensity levels with Catmull Rom splines.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("channel",
"channel",
"The channel to modify",
PIKA_TYPE_HISTOGRAM_CHANNEL,
PIKA_HISTOGRAM_VALUE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("num-values",
"num values",
"The number of values in the new curve",
256, 2096, 256,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_float_array ("values",
"values",
"The explicit curve",
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-curves-spline
*/
procedure = pika_procedure_new (drawable_curves_spline_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-curves-spline");
pika_procedure_set_static_help (procedure,
"Modifies the intensity curve(s) for specified drawable.",
"Modifies the intensity mapping for one channel in the specified 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 yields the final intensity curve. Use the 'pika-drawable-curves-explicit' function to explicitly modify intensity levels.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("channel",
"channel",
"The channel to modify",
PIKA_TYPE_HISTOGRAM_CHANNEL,
PIKA_HISTOGRAM_VALUE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("num-points",
"num points",
"The number of values in the control point array",
4, 2048, 4,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_float_array ("points",
"points",
"The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }",
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-extract-component
*/
procedure = pika_procedure_new (drawable_extract_component_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-extract-component");
pika_procedure_set_static_help (procedure,
"Extract a color model component.",
"Extract a color model component.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Compatibility procedure. Please see 'gegl:component-extract' for credits.",
"Compatibility procedure. Please see 'gegl:component-extract' for credits.",
"2021");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("component",
"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))",
0, 20, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("invert",
"invert",
"Invert the extracted component",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("linear",
"linear",
"Use linear output instead of gamma corrected",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-desaturate
*/
procedure = pika_procedure_new (drawable_desaturate_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-desaturate");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Karine Delvare",
"Karine Delvare",
"2005");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("desaturate-mode",
"desaturate mode",
"The formula to use to desaturate",
PIKA_TYPE_DESATURATE_MODE,
PIKA_DESATURATE_LIGHTNESS,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-equalize
*/
procedure = pika_procedure_new (drawable_equalize_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-equalize");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("mask-only",
"mask only",
"Equalization option",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-histogram
*/
procedure = pika_procedure_new (drawable_histogram_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-histogram");
pika_procedure_set_static_help (procedure,
"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 'pika-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 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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("channel",
"channel",
"The channel to query",
PIKA_TYPE_HISTOGRAM_CHANNEL,
PIKA_HISTOGRAM_VALUE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("start-range",
"start range",
"Start of the intensity measurement range",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("end-range",
"end range",
"End of the intensity measurement range",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("mean",
"mean",
"Mean intensity value",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("std-dev",
"std dev",
"Standard deviation of intensity values",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("median",
"median",
"Median intensity value",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("pixels",
"pixels",
"Alpha-weighted pixel count for entire image",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("count",
"count",
"Alpha-weighted pixel count for range",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_double ("percentile",
"percentile",
"Percentile that range falls under",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-hue-saturation
*/
procedure = pika_procedure_new (drawable_hue_saturation_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-hue-saturation");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("hue-range",
"hue range",
"Range of affected hues",
PIKA_TYPE_HUE_RANGE,
PIKA_HUE_RANGE_ALL,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("hue-offset",
"hue offset",
"Hue offset in degrees",
-180, 180, -180,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("lightness",
"lightness",
"Lightness modification",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("saturation",
"saturation",
"Saturation modification",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("overlap",
"overlap",
"Overlap other hue channels",
0, 100, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-invert
*/
procedure = pika_procedure_new (drawable_invert_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-invert");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("linear",
"linear",
"Whether to invert in linear space",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-levels
*/
procedure = pika_procedure_new (drawable_levels_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-levels");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("channel",
"channel",
"The channel to modify",
PIKA_TYPE_HISTOGRAM_CHANNEL,
PIKA_HISTOGRAM_VALUE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("low-input",
"low input",
"Intensity of lowest input",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("high-input",
"high input",
"Intensity of highest input",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("clamp-input",
"clamp input",
"Clamp input values before applying output levels",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("gamma",
"gamma",
"Gamma adjustment factor",
0.1, 10, 0.1,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("low-output",
"low output",
"Intensity of lowest output",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("high-output",
"high output",
"Intensity of highest output",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_boolean ("clamp-output",
"clamp output",
"Clamp final output values",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-levels-stretch
*/
procedure = pika_procedure_new (drawable_levels_stretch_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-levels-stretch");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Joao S.O. Bueno, Shawn Willden",
"Joao S.O. Bueno, Shawn Willden",
"2003");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-shadows-highlights
*/
procedure = pika_procedure_new (drawable_shadows_highlights_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-shadows-highlights");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Compatibility procedure. Please see 'gegl:shadows-highlights' for credits.",
"Compatibility procedure. Please see 'gegl:shadows-highlights' for credits.",
"2021");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("shadows",
"shadows",
"Adjust exposure of shadows",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("highlights",
"highlights",
"Adjust exposure of highlights",
-100, 100, -100,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("whitepoint",
"whitepoint",
"Shift white point",
-10, 10, -10,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("radius",
"radius",
"Spatial extent",
0.1, 1500, 0.1,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("compress",
"compress",
"Compress the effect on shadows/highlights and preserve midtones",
0, 100, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("shadows-ccorrect",
"shadows ccorrect",
"Adjust saturation of shadows",
0, 100, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("highlights-ccorrect",
"highlights ccorrect",
"Adjust saturation of highlights",
0, 100, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-posterize
*/
procedure = pika_procedure_new (drawable_posterize_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-posterize");
pika_procedure_set_static_help (procedure,
"Posterize the specified drawable.",
"This procedures reduces the number of shades allows in each intensity channel to the specified 'levels' parameter.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("levels",
"levels",
"Levels of posterization",
2, 255, 2,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-drawable-threshold
*/
procedure = pika_procedure_new (drawable_threshold_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-drawable-threshold");
pika_procedure_set_static_help (procedure,
"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.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
pika_procedure_add_argument (procedure,
pika_param_spec_drawable ("drawable",
"drawable",
"The drawable",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_enum ("channel",
"channel",
"The channel to base the threshold on",
PIKA_TYPE_HISTOGRAM_CHANNEL,
PIKA_HISTOGRAM_VALUE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("low-threshold",
"low threshold",
"The low threshold value",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("high-threshold",
"high threshold",
"The high threshold value",
0.0, 1.0, 0.0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}