2012-05-11 03:22:44 +08: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-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2012-05-11 03:22:44 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2016-01-21 04:26:43 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2012-05-11 03:22:44 +08:00
|
|
|
#include <gegl.h>
|
|
|
|
|
2017-03-24 08:29:50 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2012-05-11 03:22:44 +08:00
|
|
|
#include "operations-types.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
|
|
|
|
#include "gimp-operations.h"
|
|
|
|
|
|
|
|
#include "gimpoperationborder.h"
|
2017-12-05 04:13:48 +08:00
|
|
|
#include "gimpoperationbuffersourcevalidate.h"
|
2012-05-11 03:22:44 +08:00
|
|
|
#include "gimpoperationcagecoefcalc.h"
|
|
|
|
#include "gimpoperationcagetransform.h"
|
2016-05-23 20:00:35 +08:00
|
|
|
#include "gimpoperationcomposecrop.h"
|
2012-05-11 03:22:44 +08:00
|
|
|
#include "gimpoperationequalize.h"
|
2019-03-28 03:10:53 +08:00
|
|
|
#include "gimpoperationfillsource.h"
|
2016-01-25 01:08:43 +08:00
|
|
|
#include "gimpoperationflood.h"
|
2018-04-14 05:36:16 +08:00
|
|
|
#include "gimpoperationgradient.h"
|
2012-05-11 03:22:44 +08:00
|
|
|
#include "gimpoperationgrow.h"
|
|
|
|
#include "gimpoperationhistogramsink.h"
|
|
|
|
#include "gimpoperationmaskcomponents.h"
|
2019-06-06 05:53:16 +08:00
|
|
|
#include "gimpoperationoffset.h"
|
2016-05-23 20:00:35 +08:00
|
|
|
#include "gimpoperationprofiletransform.h"
|
2014-11-07 07:39:22 +08:00
|
|
|
#include "gimpoperationscalarmultiply.h"
|
2012-05-11 03:22:44 +08: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-06 03:17:31 +08:00
|
|
|
#include "gimp-operation-config.h"
|
2016-01-21 04:26:43 +08:00
|
|
|
#include "gimpbrightnesscontrastconfig.h"
|
|
|
|
#include "gimpcolorbalanceconfig.h"
|
|
|
|
#include "gimpcurvesconfig.h"
|
|
|
|
#include "gimphuesaturationconfig.h"
|
|
|
|
#include "gimplevelsconfig.h"
|
|
|
|
|
2017-01-10 08:37:26 +08:00
|
|
|
#include "layer-modes-legacy/gimpoperationadditionlegacy.h"
|
2017-01-11 22:00:37 +08:00
|
|
|
#include "layer-modes-legacy/gimpoperationburnlegacy.h"
|
2017-01-10 10:07:36 +08:00
|
|
|
#include "layer-modes-legacy/gimpoperationdarkenonlylegacy.h"
|
2017-01-11 22:00:37 +08: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 18:17:05 +08:00
|
|
|
#include "layer-modes-legacy/gimpoperationhslcolorlegacy.h"
|
2017-01-11 02:37:51 +08:00
|
|
|
#include "layer-modes-legacy/gimpoperationhsvhuelegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationhsvsaturationlegacy.h"
|
|
|
|
#include "layer-modes-legacy/gimpoperationhsvvaluelegacy.h"
|
2017-01-11 22:00:37 +08: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 22:59:29 +08:00
|
|
|
#include "layer-modes/gimp-layer-modes.h"
|
2017-01-11 22:00:37 +08:00
|
|
|
#include "layer-modes/gimpoperationantierase.h"
|
|
|
|
#include "layer-modes/gimpoperationbehind.h"
|
|
|
|
#include "layer-modes/gimpoperationdissolve.h"
|
2017-03-11 06:59:17 +08:00
|
|
|
#include "layer-modes/gimpoperationerase.h"
|
|
|
|
#include "layer-modes/gimpoperationmerge.h"
|
2017-01-11 22:00:37 +08:00
|
|
|
#include "layer-modes/gimpoperationnormal.h"
|
2017-08-31 23:20:37 +08:00
|
|
|
#include "layer-modes/gimpoperationpassthrough.h"
|
2017-01-11 19:55:13 +08:00
|
|
|
#include "layer-modes/gimpoperationreplace.h"
|
2017-03-11 07:28:40 +08:00
|
|
|
#include "layer-modes/gimpoperationsplit.h"
|
2012-05-11 03:22:44 +08:00
|
|
|
|
|
|
|
|
2017-03-24 08:29:50 +08: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-06 04:00:17 +08: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-11 03:22:44 +08:00
|
|
|
void
|
2017-03-24 08:29:50 +08:00
|
|
|
gimp_operations_init (Gimp *gimp)
|
2012-05-11 03:22:44 +08:00
|
|
|
{
|
2017-03-24 08:29:50 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2017-02-05 22:59:29 +08:00
|
|
|
gimp_layer_modes_init ();
|
|
|
|
|
2012-05-11 03:22:44 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BORDER);
|
2017-12-05 04:13:48 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BUFFER_SOURCE_VALIDATE);
|
2012-05-11 03:22:44 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_COEF_CALC);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_CAGE_TRANSFORM);
|
2016-05-17 00:08:48 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_COMPOSE_CROP);
|
2012-05-11 03:22:44 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_EQUALIZE);
|
2019-03-28 03:10:53 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_FILL_SOURCE);
|
2016-01-25 01:08:43 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_FLOOD);
|
2018-04-14 05:36:16 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRADIENT);
|
2012-05-11 03:22:44 +08: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-06 05:53:16 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_OFFSET);
|
2016-05-23 20:00:35 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_PROFILE_TRANSFORM);
|
2014-11-07 07:39:22 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SCALAR_MULTIPLY);
|
2012-05-11 03:22:44 +08: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-10 04:57:15 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_NORMAL);
|
2017-01-10 16:06:16 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DISSOLVE);
|
2017-01-11 19:55:13 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BEHIND);
|
2017-01-09 09:03:52 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY_LEGACY);
|
2017-01-10 06:56:45 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SCREEN_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DIFFERENCE_LEGACY);
|
2017-01-10 08:37:26 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT_LEGACY);
|
2017-01-10 10:07:36 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY);
|
2017-01-11 02:37:51 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY);
|
2017-03-16 18:17:05 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSL_COLOR_LEGACY);
|
2017-01-11 02:37:51 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY);
|
2017-01-11 10:02:54 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DIVIDE_LEGACY);
|
2017-01-09 12:32:08 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_DODGE_LEGACY);
|
2017-01-11 10:02:54 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_BURN_LEGACY);
|
2017-01-11 11:10:06 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_HARDLIGHT_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SOFTLIGHT_LEGACY);
|
2017-01-11 11:36:31 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_EXTRACT_LEGACY);
|
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_MERGE_LEGACY);
|
2017-01-11 07:21:43 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ERASE);
|
2017-03-11 06:59:17 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_MERGE);
|
2017-03-11 07:28:40 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_SPLIT);
|
2017-08-31 23:20:37 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_PASS_THROUGH);
|
2017-01-11 19:55:13 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_REPLACE);
|
2017-01-11 07:21:43 +08:00
|
|
|
g_type_class_ref (GIMP_TYPE_OPERATION_ANTI_ERASE);
|
2016-01-21 04:26:43 +08:00
|
|
|
|
2017-03-24 08:29:50 +08:00
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:brightness-contrast",
|
2017-02-06 03:17:31 +08:00
|
|
|
GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG);
|
2017-03-24 08:29:50 +08:00
|
|
|
set_compat_file (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
|
|
|
"gimp-brightness-contrast-tool.settings");
|
2017-06-06 04:00:17 +08:00
|
|
|
set_settings_folder (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
|
|
|
|
"brightness-contrast");
|
2017-03-24 08:29:50 +08:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:color-balance",
|
2017-02-06 03:17:31 +08:00
|
|
|
GIMP_TYPE_COLOR_BALANCE_CONFIG);
|
2017-03-24 08:29:50 +08:00
|
|
|
set_compat_file (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
|
|
|
"gimp-color-balance-tool.settings");
|
2017-06-06 04:00:17 +08:00
|
|
|
set_settings_folder (GIMP_TYPE_COLOR_BALANCE_CONFIG,
|
|
|
|
"color-balance");
|
2017-03-24 08:29:50 +08:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:curves",
|
2017-02-06 03:17:31 +08:00
|
|
|
GIMP_TYPE_CURVES_CONFIG);
|
2017-03-24 08:29:50 +08:00
|
|
|
set_compat_file (GIMP_TYPE_CURVES_CONFIG,
|
|
|
|
"gimp-curves-tool.settings");
|
2017-06-06 04:00:17 +08:00
|
|
|
set_settings_folder (GIMP_TYPE_CURVES_CONFIG,
|
|
|
|
"curves");
|
2017-03-24 08:29:50 +08:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:hue-saturation",
|
2017-02-06 03:17:31 +08:00
|
|
|
GIMP_TYPE_HUE_SATURATION_CONFIG);
|
2017-03-24 08:29:50 +08:00
|
|
|
set_compat_file (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
|
|
|
"gimp-hue-saturation-tool.settings");
|
2017-06-06 04:00:17 +08:00
|
|
|
set_settings_folder (GIMP_TYPE_HUE_SATURATION_CONFIG,
|
|
|
|
"hue-saturation");
|
2017-03-24 08:29:50 +08:00
|
|
|
|
|
|
|
gimp_operation_config_register (gimp,
|
|
|
|
"gimp:levels",
|
2017-02-06 03:17:31 +08:00
|
|
|
GIMP_TYPE_LEVELS_CONFIG);
|
2017-03-24 08:29:50 +08:00
|
|
|
set_compat_file (GIMP_TYPE_LEVELS_CONFIG,
|
|
|
|
"gimp-levels-tool.settings");
|
2017-06-06 04:00:17 +08:00
|
|
|
set_settings_folder (GIMP_TYPE_LEVELS_CONFIG,
|
|
|
|
"levels");
|
2012-05-11 03:22:44 +08:00
|
|
|
}
|