2012-05-10 21:22:44 +02:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimp-operations.c
|
|
|
|
*
|
|
|
|
* 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
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2012-05-10 21:22:44 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2016-01-20 21:26:43 +01:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2012-05-10 21:22:44 +02:00
|
|
|
#include <gegl.h>
|
|
|
|
|
2017-03-24 01:29:50 +01:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2012-05-10 21:22:44 +02:00
|
|
|
#include "operations-types.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
|
|
|
|
#include "gimp-operations.h"
|
|
|
|
|
|
|
|
#include "gimpoperationborder.h"
|
2017-12-04 15:13:48 -05:00
|
|
|
#include "gimpoperationbuffersourcevalidate.h"
|
2012-05-10 21:22:44 +02:00
|
|
|
#include "gimpoperationcagecoefcalc.h"
|
|
|
|
#include "gimpoperationcagetransform.h"
|
2016-05-23 14:00:35 +02:00
|
|
|
#include "gimpoperationcomposecrop.h"
|
2012-05-10 21:22:44 +02:00
|
|
|
#include "gimpoperationequalize.h"
|
2019-03-27 15:10:53 -04:00
|
|
|
#include "gimpoperationfillsource.h"
|
2016-01-24 17:08:43 +00:00
|
|
|
#include "gimpoperationflood.h"
|
2018-04-13 23:36:16 +02:00
|
|
|
#include "gimpoperationgradient.h"
|
2012-05-10 21:22:44 +02:00
|
|
|
#include "gimpoperationgrow.h"
|
|
|
|
#include "gimpoperationhistogramsink.h"
|
|
|
|
#include "gimpoperationmaskcomponents.h"
|
2019-06-05 17:53:16 -04:00
|
|
|
#include "gimpoperationoffset.h"
|
2016-05-23 14:00:35 +02:00
|
|
|
#include "gimpoperationprofiletransform.h"
|
2014-11-07 00:39:22 +01:00
|
|
|
#include "gimpoperationscalarmultiply.h"
|
2012-05-10 21:22:44 +02:00
|
|
|
#include "gimpoperationsemiflatten.h"
|
|
|
|
#include "gimpoperationsetalpha.h"
|
|
|
|
#include "gimpoperationshrink.h"
|
|
|
|
#include "gimpoperationthresholdalpha.h"
|
|
|
|
|
|
|
|
#include "gimpoperationbrightnesscontrast.h"
|
|
|
|
#include "gimpoperationcolorbalance.h"
|
|
|
|
#include "gimpoperationcolorize.h"
|
|
|
|
#include "gimpoperationcurves.h"
|
|
|
|
#include "gimpoperationdesaturate.h"
|
|
|
|
#include "gimpoperationhuesaturation.h"
|
|
|
|
#include "gimpoperationlevels.h"
|
|
|
|
#include "gimpoperationposterize.h"
|
|
|
|
#include "gimpoperationthreshold.h"
|
|
|
|
|
2017-02-05 20:17:31 +01:00
|
|
|
#include "gimp-operation-config.h"
|
2016-01-20 21:26:43 +01:00
|
|
|
#include "gimpbrightnesscontrastconfig.h"
|
|
|
|
#include "gimpcolorbalanceconfig.h"
|
|
|
|
#include "gimpcurvesconfig.h"
|
|
|
|
#include "gimphuesaturationconfig.h"
|
|
|
|
#include "gimplevelsconfig.h"
|
|
|
|
|
2017-01-10 01:37:26 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationadditionlegacy.h"
|
2017-01-11 15:00:37 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationburnlegacy.h"
|
2017-01-10 03:07:36 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationdarkenonlylegacy.h"
|
2017-01-11 15:00:37 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationdifferencelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationdividelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationdodgelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationgrainextractlegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationgrainmergelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationhardlightlegacy.h"
|
2017-03-16 06:17:05 -04:00
|
|
|
#include "layer-modes-legacy/gimpoperationhslcolorlegacy.h"
|
2017-01-10 19:37:51 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationhsvhuelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationhsvsaturationlegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationhsvvaluelegacy.h"
|
2017-01-11 15:00:37 +01:00
|
|
|
#include "layer-modes-legacy/gimpoperationlightenonlylegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationmultiplylegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationscreenlegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationsoftlightlegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationsubtractlegacy.h"
|
|
|
|
|
2017-02-05 15:59:29 +01:00
|
|
|
#include "layer-modes/gimp-layer-modes.h"
|
2017-01-11 15:00:37 +01:00
|
|
|
#include "layer-modes/gimpoperationantierase.h"
|
|
|
|
#include "layer-modes/gimpoperationbehind.h"
|
|
|
|
#include "layer-modes/gimpoperationdissolve.h"
|
2017-03-10 17:59:17 -05:00
|
|
|
#include "layer-modes/gimpoperationerase.h"
|
|
|
|
#include "layer-modes/gimpoperationmerge.h"
|
2017-01-11 15:00:37 +01:00
|
|
|
#include "layer-modes/gimpoperationnormal.h"
|
2017-08-31 11:20:37 -04:00
|
|
|
#include "layer-modes/gimpoperationpassthrough.h"
|
2017-01-11 12:55:13 +01:00
|
|
|
#include "layer-modes/gimpoperationreplace.h"
|
2017-03-10 18:28:40 -05:00
|
|
|
#include "layer-modes/gimpoperationsplit.h"
|
2012-05-10 21:22:44 +02:00
|
|
|
|
|
|
|
|
2017-03-24 01:29:50 +01:00
|
|
|
static void
|
|
|
|
set_compat_file (GType type,
|
|
|
|
const gchar *basename)
|
|
|
|
{
|
|
|
|
GFile *file = gimp_directory_file ("tool-options", basename, NULL);
|
|
|
|
GQuark quark = g_quark_from_static_string ("compat-file");
|
|
|
|
|
|
|
|
g_type_set_qdata (type, quark, file);
|
|
|
|
}
|
|
|
|
|
2017-06-05 22:00:17 +02:00
|
|
|
static void
|
|
|
|
set_settings_folder (GType type,
|
|
|
|
const gchar *basename)
|
|
|
|
{
|
|
|
|
GFile *file = gimp_directory_file (basename, NULL);
|
|
|
|
GQuark quark = g_quark_from_static_string ("settings-folder");
|
|
|
|
|
|
|
|
g_type_set_qdata (type, quark, file);
|
|
|
|
}
|
|
|
|
|
2012-05-10 21:22:44 +02:00
|
|
|
void
|
2017-03-24 01:29:50 +01:00
|
|
|
gimp_operations_init (Gimp *gimp)
|
2012-05-10 21:22:44 +02:00
|
|
|
{
|
2017-03-24 01:29:50 +01:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2017-02-05 15:59:29 +01:00
|
|
|
gimp_layer_modes_init ();
|
|
|
|
|
2012-05-10 21:22:44 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BORDER);
|
2017-12-04 15:13:48 -05:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BUFFER_SOURCE_VALIDATE);
|
2012-05-10 21:22:44 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_COEF_CALC);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_TRANSFORM);
|
2016-05-16 18:08:48 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_COMPOSE_CROP);
|
2012-05-10 21:22:44 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_EQUALIZE);
|
2019-03-27 15:10:53 -04:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_FILL_SOURCE);
|
2016-01-24 17:08:43 +00:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_FLOOD);
|
2018-04-13 23:36:16 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRADIENT);
|
2012-05-10 21:22:44 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GROW);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HISTOGRAM_SINK);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_MASK_COMPONENTS);
|
2019-06-05 17:53:16 -04:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_OFFSET);
|
2016-05-23 14:00:35 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_PROFILE_TRANSFORM);
|
2014-11-07 00:39:22 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SCALAR_MULTIPLY);
|
2012-05-10 21:22:44 +02:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SEMI_FLATTEN);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SET_ALPHA);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SHRINK);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_THRESHOLD_ALPHA);
|
|
|
|
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BRIGHTNESS_CONTRAST);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_BALANCE);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_COLORIZE);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_CURVES);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DESATURATE);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HUE_SATURATION);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_LEVELS);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_POSTERIZE);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_THRESHOLD);
|
|
|
|
|
2017-01-09 21:57:15 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_NORMAL);
|
2017-01-10 09:06:16 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DISSOLVE);
|
2017-01-11 12:55:13 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BEHIND);
|
2017-01-09 02:03:52 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY_LEGACY);
|
2017-01-09 23:56:45 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SCREEN_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DIFFERENCE_LEGACY);
|
2017-01-10 01:37:26 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT_LEGACY);
|
2017-01-10 03:07:36 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY);
|
2017-01-10 19:37:51 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY);
|
2017-03-16 06:17:05 -04:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSL_COLOR_LEGACY);
|
2017-01-10 19:37:51 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY);
|
2017-01-11 03:02:54 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DIVIDE_LEGACY);
|
2017-01-09 05:32:08 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DODGE_LEGACY);
|
2017-01-11 03:02:54 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BURN_LEGACY);
|
2017-01-11 04:10:06 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HARDLIGHT_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SOFTLIGHT_LEGACY);
|
2017-01-11 04:36:31 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_EXTRACT_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_MERGE_LEGACY);
|
2017-01-11 00:21:43 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ERASE);
|
2017-03-10 17:59:17 -05:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_MERGE);
|
2017-03-10 18:28:40 -05:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SPLIT);
|
2017-08-31 11:20:37 -04:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_PASS_THROUGH);
|
2017-01-11 12:55:13 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_REPLACE);
|
2017-01-11 00:21:43 +01:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ANTI_ERASE);
|
2016-01-20 21:26:43 +01:00
|
|
|
|
2017-03-24 01:29:50 +01:00
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:brightness-contrast",
|
2017-02-05 20:17:31 +01:00
|
|
|
GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG);
|
2017-03-24 01:29:50 +01:00
|
|
|
set_compat_file (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
|
|
|
"gimp-brightness-contrast-tool.settings");
|
2017-06-05 22:00:17 +02:00
|
|
|
set_settings_folder (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
|
|
|
"brightness-contrast");
|
2017-03-24 01:29:50 +01:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:color-balance",
|
2017-02-05 20:17:31 +01:00
|
|
|
GIMP_TYPE_COLOR_BALANCE_CONFIG);
|
2017-03-24 01:29:50 +01:00
|
|
|
set_compat_file (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
|
|
|
"gimp-color-balance-tool.settings");
|
2017-06-05 22:00:17 +02:00
|
|
|
set_settings_folder (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
|
|
|
"color-balance");
|
2017-03-24 01:29:50 +01:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:curves",
|
2017-02-05 20:17:31 +01:00
|
|
|
GIMP_TYPE_CURVES_CONFIG);
|
2017-03-24 01:29:50 +01:00
|
|
|
set_compat_file (GIMP_TYPE_CURVES_CONFIG,
|
|
|
|
"gimp-curves-tool.settings");
|
2017-06-05 22:00:17 +02:00
|
|
|
set_settings_folder (GIMP_TYPE_CURVES_CONFIG,
|
|
|
|
"curves");
|
2017-03-24 01:29:50 +01:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:hue-saturation",
|
2017-02-05 20:17:31 +01:00
|
|
|
GIMP_TYPE_HUE_SATURATION_CONFIG);
|
2017-03-24 01:29:50 +01:00
|
|
|
set_compat_file (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
|
|
|
"gimp-hue-saturation-tool.settings");
|
2017-06-05 22:00:17 +02:00
|
|
|
set_settings_folder (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
|
|
|
"hue-saturation");
|
2017-03-24 01:29:50 +01:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:levels",
|
2017-02-05 20:17:31 +01:00
|
|
|
GIMP_TYPE_LEVELS_CONFIG);
|
2017-03-24 01:29:50 +01:00
|
|
|
set_compat_file (GIMP_TYPE_LEVELS_CONFIG,
|
|
|
|
"gimp-levels-tool.settings");
|
2017-06-05 22:00:17 +02:00
|
|
|
set_settings_folder (GIMP_TYPE_LEVELS_CONFIG,
|
|
|
|
"levels");
|
2012-05-10 21:22:44 +02:00
|
|
|
}
|