PIKApp/app/operations/pika-operations.c

238 lines
9.4 KiB
C
Raw Permalink Normal View History

2023-09-26 00:35:21 +02:00
/* 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 Spencer Kimball and Peter Mattis
*
* pika-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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libpikabase/pikabase.h"
#include "operations-types.h"
#include "core/pika.h"
#include "pika-operations.h"
#include "pikaoperationborder.h"
#include "pikaoperationbuffersourcevalidate.h"
#include "pikaoperationcagecoefcalc.h"
#include "pikaoperationcagetransform.h"
#include "pikaoperationcomposecrop.h"
#include "pikaoperationequalize.h"
#include "pikaoperationfillsource.h"
#include "pikaoperationflood.h"
#include "pikaoperationgradient.h"
#include "pikaoperationgrow.h"
#include "pikaoperationhistogramsink.h"
#include "pikaoperationmaskcomponents.h"
#include "pikaoperationoffset.h"
#include "pikaoperationprofiletransform.h"
#include "pikaoperationscalarmultiply.h"
#include "pikaoperationsemiflatten.h"
#include "pikaoperationsetalpha.h"
#include "pikaoperationshrink.h"
#include "pikaoperationthresholdalpha.h"
#include "pikaoperationbrightnesscontrast.h"
#include "pikaoperationcolorbalance.h"
#include "pikaoperationcolorize.h"
#include "pikaoperationcurves.h"
#include "pikaoperationdesaturate.h"
#include "pikaoperationhuesaturation.h"
#include "pikaoperationlevels.h"
#include "pikaoperationposterize.h"
#include "pikaoperationthreshold.h"
#include "pika-operation-config.h"
#include "pikabrightnesscontrastconfig.h"
#include "pikacolorbalanceconfig.h"
#include "pikacurvesconfig.h"
#include "pikahuesaturationconfig.h"
#include "pikalevelsconfig.h"
#include "layer-modes-legacy/pikaoperationadditionlegacy.h"
#include "layer-modes-legacy/pikaoperationburnlegacy.h"
#include "layer-modes-legacy/pikaoperationdarkenonlylegacy.h"
#include "layer-modes-legacy/pikaoperationdifferencelegacy.h"
#include "layer-modes-legacy/pikaoperationdividelegacy.h"
#include "layer-modes-legacy/pikaoperationdodgelegacy.h"
#include "layer-modes-legacy/pikaoperationgrainextractlegacy.h"
#include "layer-modes-legacy/pikaoperationgrainmergelegacy.h"
#include "layer-modes-legacy/pikaoperationhardlightlegacy.h"
#include "layer-modes-legacy/pikaoperationhslcolorlegacy.h"
#include "layer-modes-legacy/pikaoperationhsvhuelegacy.h"
#include "layer-modes-legacy/pikaoperationhsvsaturationlegacy.h"
#include "layer-modes-legacy/pikaoperationhsvvaluelegacy.h"
#include "layer-modes-legacy/pikaoperationlightenonlylegacy.h"
#include "layer-modes-legacy/pikaoperationmultiplylegacy.h"
#include "layer-modes-legacy/pikaoperationscreenlegacy.h"
#include "layer-modes-legacy/pikaoperationsoftlightlegacy.h"
#include "layer-modes-legacy/pikaoperationsubtractlegacy.h"
#include "layer-modes/pika-layer-modes.h"
#include "layer-modes/pikaoperationantierase.h"
#include "layer-modes/pikaoperationbehind.h"
#include "layer-modes/pikaoperationdissolve.h"
#include "layer-modes/pikaoperationerase.h"
#include "layer-modes/pikaoperationmerge.h"
#include "layer-modes/pikaoperationnormal.h"
#include "layer-modes/pikaoperationpassthrough.h"
#include "layer-modes/pikaoperationreplace.h"
#include "layer-modes/pikaoperationsplit.h"
static void
set_compat_file (GType type,
const gchar *basename)
{
GFile *file = pika_directory_file ("tool-options", basename, NULL);
GQuark quark = g_quark_from_static_string ("compat-file");
g_type_set_qdata (type, quark, file);
}
static void
set_settings_folder (GType type,
const gchar *basename)
{
GFile *file = pika_directory_file (basename, NULL);
GQuark quark = g_quark_from_static_string ("settings-folder");
g_type_set_qdata (type, quark, file);
}
void
pika_operations_init (Pika *pika)
{
g_return_if_fail (PIKA_IS_PIKA (pika));
pika_layer_modes_init ();
g_type_class_ref (PIKA_TYPE_OPERATION_BORDER);
g_type_class_ref (PIKA_TYPE_OPERATION_BUFFER_SOURCE_VALIDATE);
g_type_class_ref (PIKA_TYPE_OPERATION_CAGE_COEF_CALC);
g_type_class_ref (PIKA_TYPE_OPERATION_CAGE_TRANSFORM);
g_type_class_ref (PIKA_TYPE_OPERATION_COMPOSE_CROP);
g_type_class_ref (PIKA_TYPE_OPERATION_EQUALIZE);
g_type_class_ref (PIKA_TYPE_OPERATION_FILL_SOURCE);
g_type_class_ref (PIKA_TYPE_OPERATION_FLOOD);
g_type_class_ref (PIKA_TYPE_OPERATION_GRADIENT);
g_type_class_ref (PIKA_TYPE_OPERATION_GROW);
g_type_class_ref (PIKA_TYPE_OPERATION_HISTOGRAM_SINK);
g_type_class_ref (PIKA_TYPE_OPERATION_MASK_COMPONENTS);
g_type_class_ref (PIKA_TYPE_OPERATION_OFFSET);
g_type_class_ref (PIKA_TYPE_OPERATION_PROFILE_TRANSFORM);
g_type_class_ref (PIKA_TYPE_OPERATION_SCALAR_MULTIPLY);
g_type_class_ref (PIKA_TYPE_OPERATION_SEMI_FLATTEN);
g_type_class_ref (PIKA_TYPE_OPERATION_SET_ALPHA);
g_type_class_ref (PIKA_TYPE_OPERATION_SHRINK);
g_type_class_ref (PIKA_TYPE_OPERATION_THRESHOLD_ALPHA);
g_type_class_ref (PIKA_TYPE_OPERATION_BRIGHTNESS_CONTRAST);
g_type_class_ref (PIKA_TYPE_OPERATION_COLOR_BALANCE);
g_type_class_ref (PIKA_TYPE_OPERATION_COLORIZE);
g_type_class_ref (PIKA_TYPE_OPERATION_CURVES);
g_type_class_ref (PIKA_TYPE_OPERATION_DESATURATE);
g_type_class_ref (PIKA_TYPE_OPERATION_HUE_SATURATION);
g_type_class_ref (PIKA_TYPE_OPERATION_LEVELS);
g_type_class_ref (PIKA_TYPE_OPERATION_POSTERIZE);
g_type_class_ref (PIKA_TYPE_OPERATION_THRESHOLD);
g_type_class_ref (PIKA_TYPE_OPERATION_NORMAL);
g_type_class_ref (PIKA_TYPE_OPERATION_DISSOLVE);
g_type_class_ref (PIKA_TYPE_OPERATION_BEHIND);
g_type_class_ref (PIKA_TYPE_OPERATION_MULTIPLY_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_SCREEN_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_DIFFERENCE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_ADDITION_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_SUBTRACT_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_DARKEN_ONLY_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_HSV_HUE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_HSV_SATURATION_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_HSL_COLOR_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_HSV_VALUE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_DIVIDE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_DODGE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_BURN_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_HARDLIGHT_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_SOFTLIGHT_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_GRAIN_EXTRACT_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_GRAIN_MERGE_LEGACY);
g_type_class_ref (PIKA_TYPE_OPERATION_ERASE);
g_type_class_ref (PIKA_TYPE_OPERATION_MERGE);
g_type_class_ref (PIKA_TYPE_OPERATION_SPLIT);
g_type_class_ref (PIKA_TYPE_OPERATION_PASS_THROUGH);
g_type_class_ref (PIKA_TYPE_OPERATION_REPLACE);
g_type_class_ref (PIKA_TYPE_OPERATION_ANTI_ERASE);
pika_operation_config_register (pika,
"pika:brightness-contrast",
PIKA_TYPE_BRIGHTNESS_CONTRAST_CONFIG);
set_compat_file (PIKA_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
"pika-brightness-contrast-tool.settings");
set_settings_folder (PIKA_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
"brightness-contrast");
pika_operation_config_register (pika,
"pika:color-balance",
PIKA_TYPE_COLOR_BALANCE_CONFIG);
set_compat_file (PIKA_TYPE_COLOR_BALANCE_CONFIG,
"pika-color-balance-tool.settings");
set_settings_folder (PIKA_TYPE_COLOR_BALANCE_CONFIG,
"color-balance");
pika_operation_config_register (pika,
"pika:curves",
PIKA_TYPE_CURVES_CONFIG);
set_compat_file (PIKA_TYPE_CURVES_CONFIG,
"pika-curves-tool.settings");
set_settings_folder (PIKA_TYPE_CURVES_CONFIG,
"curves");
pika_operation_config_register (pika,
"pika:hue-saturation",
PIKA_TYPE_HUE_SATURATION_CONFIG);
set_compat_file (PIKA_TYPE_HUE_SATURATION_CONFIG,
"pika-hue-saturation-tool.settings");
set_settings_folder (PIKA_TYPE_HUE_SATURATION_CONFIG,
"hue-saturation");
pika_operation_config_register (pika,
"pika:levels",
PIKA_TYPE_LEVELS_CONFIG);
set_compat_file (PIKA_TYPE_LEVELS_CONFIG,
"pika-levels-tool.settings");
set_settings_folder (PIKA_TYPE_LEVELS_CONFIG,
"levels");
}
void
pika_operations_exit (Pika *pika)
{
g_return_if_fail (PIKA_IS_PIKA (pika));
pika_layer_modes_exit ();
}