From d836d94114380c38867b071b14fdd1203f932849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 22 Jan 2017 19:48:49 +0100 Subject: [PATCH] app: implement non-legacy blend modes in GimpOperationLayerMode For operations needing to override default behavior sub-classes should still be used. This commit also enables pinligh, vividlight and linearlight blend mode modes --- app/core/core-enums.c | 20 + app/core/core-enums.h | 10 + app/core/gimp-layer-modes.c | 122 +- app/operations/gimp-operations.c | 50 +- app/operations/layer-modes/Makefile.am | 49 +- .../layer-modes/gimpblendcomposite.h | 1271 ---------------- .../layer-modes/gimplayermodefunctions.c | 131 +- .../layer-modes/gimpoperationaddition.c | 73 - .../layer-modes/gimpoperationaddition.h | 63 - .../layer-modes/gimpoperationburn.c | 72 - .../layer-modes/gimpoperationburn.h | 63 - .../layer-modes/gimpoperationdarkenonly.c | 72 - .../layer-modes/gimpoperationdarkenonly.h | 63 - .../layer-modes/gimpoperationdifference.c | 72 - .../layer-modes/gimpoperationdifference.h | 63 - .../layer-modes/gimpoperationdivide.c | 72 - .../layer-modes/gimpoperationdivide.h | 63 - .../layer-modes/gimpoperationdodge.c | 72 - .../layer-modes/gimpoperationdodge.h | 63 - .../layer-modes/gimpoperationgrainextract.c | 72 - .../layer-modes/gimpoperationgrainextract.h | 63 - .../layer-modes/gimpoperationgrainmerge.c | 72 - .../layer-modes/gimpoperationgrainmerge.h | 63 - .../layer-modes/gimpoperationhardlight.c | 71 - .../layer-modes/gimpoperationhardlight.h | 62 - .../layer-modes/gimpoperationhsvcolor.c | 76 - .../layer-modes/gimpoperationhsvcolor.h | 63 - .../layer-modes/gimpoperationhsvhue.c | 76 - .../layer-modes/gimpoperationhsvhue.h | 63 - .../layer-modes/gimpoperationhsvsaturation.c | 76 - .../layer-modes/gimpoperationhsvsaturation.h | 63 - .../layer-modes/gimpoperationhsvvalue.c | 76 - .../layer-modes/gimpoperationhsvvalue.h | 63 - .../layer-modes/gimpoperationlayermode.c | 1348 ++++++++++++++++- .../layer-modes/gimpoperationlayermode.h | 9 + .../layer-modes/gimpoperationlchchroma.c | 75 - .../layer-modes/gimpoperationlchchroma.h | 64 - .../layer-modes/gimpoperationlchcolor.c | 75 - .../layer-modes/gimpoperationlchcolor.h | 64 - .../layer-modes/gimpoperationlchhue.c | 75 - .../layer-modes/gimpoperationlchhue.h | 64 - .../layer-modes/gimpoperationlchlightness.c | 75 - .../layer-modes/gimpoperationlchlightness.h | 64 - .../layer-modes/gimpoperationlightenonly.c | 72 - .../layer-modes/gimpoperationlightenonly.h | 63 - .../layer-modes/gimpoperationmultiply.c | 72 - .../layer-modes/gimpoperationmultiply.h | 63 - .../layer-modes/gimpoperationoverlay.c | 71 - .../layer-modes/gimpoperationoverlay.h | 62 - .../layer-modes/gimpoperationscreen.c | 72 - .../layer-modes/gimpoperationscreen.h | 62 - .../layer-modes/gimpoperationsoftlight.c | 90 -- .../layer-modes/gimpoperationsoftlight.h | 62 - .../layer-modes/gimpoperationsubtract.c | 72 - .../layer-modes/gimpoperationsubtract.h | 63 - app/widgets/gimpwidgets-constructors.c | 9 +- libgimp/gimpenums.h | 12 +- tools/pdbgen/enums.pl | 24 +- 58 files changed, 1461 insertions(+), 4744 deletions(-) delete mode 100644 app/operations/layer-modes/gimpblendcomposite.h delete mode 100644 app/operations/layer-modes/gimpoperationaddition.c delete mode 100644 app/operations/layer-modes/gimpoperationaddition.h delete mode 100644 app/operations/layer-modes/gimpoperationburn.c delete mode 100644 app/operations/layer-modes/gimpoperationburn.h delete mode 100644 app/operations/layer-modes/gimpoperationdarkenonly.c delete mode 100644 app/operations/layer-modes/gimpoperationdarkenonly.h delete mode 100644 app/operations/layer-modes/gimpoperationdifference.c delete mode 100644 app/operations/layer-modes/gimpoperationdifference.h delete mode 100644 app/operations/layer-modes/gimpoperationdivide.c delete mode 100644 app/operations/layer-modes/gimpoperationdivide.h delete mode 100644 app/operations/layer-modes/gimpoperationdodge.c delete mode 100644 app/operations/layer-modes/gimpoperationdodge.h delete mode 100644 app/operations/layer-modes/gimpoperationgrainextract.c delete mode 100644 app/operations/layer-modes/gimpoperationgrainextract.h delete mode 100644 app/operations/layer-modes/gimpoperationgrainmerge.c delete mode 100644 app/operations/layer-modes/gimpoperationgrainmerge.h delete mode 100644 app/operations/layer-modes/gimpoperationhardlight.c delete mode 100644 app/operations/layer-modes/gimpoperationhardlight.h delete mode 100644 app/operations/layer-modes/gimpoperationhsvcolor.c delete mode 100644 app/operations/layer-modes/gimpoperationhsvcolor.h delete mode 100644 app/operations/layer-modes/gimpoperationhsvhue.c delete mode 100644 app/operations/layer-modes/gimpoperationhsvhue.h delete mode 100644 app/operations/layer-modes/gimpoperationhsvsaturation.c delete mode 100644 app/operations/layer-modes/gimpoperationhsvsaturation.h delete mode 100644 app/operations/layer-modes/gimpoperationhsvvalue.c delete mode 100644 app/operations/layer-modes/gimpoperationhsvvalue.h delete mode 100644 app/operations/layer-modes/gimpoperationlchchroma.c delete mode 100644 app/operations/layer-modes/gimpoperationlchchroma.h delete mode 100644 app/operations/layer-modes/gimpoperationlchcolor.c delete mode 100644 app/operations/layer-modes/gimpoperationlchcolor.h delete mode 100644 app/operations/layer-modes/gimpoperationlchhue.c delete mode 100644 app/operations/layer-modes/gimpoperationlchhue.h delete mode 100644 app/operations/layer-modes/gimpoperationlchlightness.c delete mode 100644 app/operations/layer-modes/gimpoperationlchlightness.h delete mode 100644 app/operations/layer-modes/gimpoperationlightenonly.c delete mode 100644 app/operations/layer-modes/gimpoperationlightenonly.h delete mode 100644 app/operations/layer-modes/gimpoperationmultiply.c delete mode 100644 app/operations/layer-modes/gimpoperationmultiply.h delete mode 100644 app/operations/layer-modes/gimpoperationoverlay.c delete mode 100644 app/operations/layer-modes/gimpoperationoverlay.h delete mode 100644 app/operations/layer-modes/gimpoperationscreen.c delete mode 100644 app/operations/layer-modes/gimpoperationscreen.h delete mode 100644 app/operations/layer-modes/gimpoperationsoftlight.c delete mode 100644 app/operations/layer-modes/gimpoperationsoftlight.h delete mode 100644 app/operations/layer-modes/gimpoperationsubtract.c delete mode 100644 app/operations/layer-modes/gimpoperationsubtract.h diff --git a/app/core/core-enums.c b/app/core/core-enums.c index 3e7b530218..12e2e80541 100644 --- a/app/core/core-enums.c +++ b/app/core/core-enums.c @@ -352,6 +352,16 @@ gimp_layer_mode_get_type (void) { GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR, "GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR", "grain-extract-linear" }, { GIMP_LAYER_MODE_GRAIN_MERGE, "GIMP_LAYER_MODE_GRAIN_MERGE", "grain-merge" }, { GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR, "GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR", "grain-merge-linear" }, + { GIMP_LAYER_MODE_VIVID_LIGHT, "GIMP_LAYER_MODE_VIVID_LIGHT", "vivid-light" }, + { GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR, "GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR", "vivid-light-linear" }, + { GIMP_LAYER_MODE_PIN_LIGHT, "GIMP_LAYER_MODE_PIN_LIGHT", "pin-light" }, + { GIMP_LAYER_MODE_PIN_LIGHT_LINEAR, "GIMP_LAYER_MODE_PIN_LIGHT_LINEAR", "pin-light-linear" }, + { GIMP_LAYER_MODE_LINEAR_LIGHT, "GIMP_LAYER_MODE_LINEAR_LIGHT", "linear-light" }, + { GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR, "GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR", "linear-light-linear" }, + { GIMP_LAYER_MODE_EXCLUSION, "GIMP_LAYER_MODE_EXCLUSION", "exclusion" }, + { GIMP_LAYER_MODE_EXCLUSION_LINEAR, "GIMP_LAYER_MODE_EXCLUSION_LINEAR", "exclusion-linear" }, + { GIMP_LAYER_MODE_LINEAR_BURN, "GIMP_LAYER_MODE_LINEAR_BURN", "linear-burn" }, + { GIMP_LAYER_MODE_LINEAR_BURN_LINEAR, "GIMP_LAYER_MODE_LINEAR_BURN_LINEAR", "linear-burn-linear" }, { GIMP_LAYER_MODE_ERASE, "GIMP_LAYER_MODE_ERASE", "erase" }, { GIMP_LAYER_MODE_REPLACE, "GIMP_LAYER_MODE_REPLACE", "replace" }, { GIMP_LAYER_MODE_ANTI_ERASE, "GIMP_LAYER_MODE_ANTI_ERASE", "anti-erase" }, @@ -423,6 +433,16 @@ gimp_layer_mode_get_type (void) { GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR, NC_("layer-mode", "Grain extract (linear)"), NULL }, { GIMP_LAYER_MODE_GRAIN_MERGE, NC_("layer-mode", "Grain merge"), NULL }, { GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR, NC_("layer-mode", "Grain merge (linear)"), NULL }, + { GIMP_LAYER_MODE_VIVID_LIGHT, NC_("layer-mode", "Vivid light"), NULL }, + { GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR, NC_("layer-mode", "Vivid light (linear)"), NULL }, + { GIMP_LAYER_MODE_PIN_LIGHT, NC_("layer-mode", "Pin light"), NULL }, + { GIMP_LAYER_MODE_PIN_LIGHT_LINEAR, NC_("layer-mode", "Pin light (linear)"), NULL }, + { GIMP_LAYER_MODE_LINEAR_LIGHT, NC_("layer-mode", "Linear light"), NULL }, + { GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR, NC_("layer-mode", "Linear light (linear)"), NULL }, + { GIMP_LAYER_MODE_EXCLUSION, NC_("layer-mode", "Exclusion"), NULL }, + { GIMP_LAYER_MODE_EXCLUSION_LINEAR, NC_("layer-mode", "Exclusion (linear)"), NULL }, + { GIMP_LAYER_MODE_LINEAR_BURN, NC_("layer-mode", "Linear light"), NULL }, + { GIMP_LAYER_MODE_LINEAR_BURN_LINEAR, NC_("layer-mode", "Linear burn (linear)"), NULL }, { GIMP_LAYER_MODE_ERASE, NC_("layer-mode", "Erase"), NULL }, { GIMP_LAYER_MODE_REPLACE, NC_("layer-mode", "Replace"), NULL }, { GIMP_LAYER_MODE_ANTI_ERASE, NC_("layer-mode", "Anti erase"), NULL }, diff --git a/app/core/core-enums.h b/app/core/core-enums.h index 4b2ae315d3..acd103fc2b 100644 --- a/app/core/core-enums.h +++ b/app/core/core-enums.h @@ -222,6 +222,16 @@ typedef enum GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR, /*< desc="Grain extract (linear)" >*/ GIMP_LAYER_MODE_GRAIN_MERGE, /*< desc="Grain merge" >*/ GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR, /*< desc="Grain merge (linear)" >*/ + GIMP_LAYER_MODE_VIVID_LIGHT, /*< desc="Vivid light" >*/ + GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR, /*< desc="Vivid light (linear)" >*/ + GIMP_LAYER_MODE_PIN_LIGHT, /*< desc="Pin light" >*/ + GIMP_LAYER_MODE_PIN_LIGHT_LINEAR, /*< desc="Pin light (linear)" >*/ + GIMP_LAYER_MODE_LINEAR_LIGHT, /*< desc="Linear light" >*/ + GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR, /*< desc="Linear light (linear)" >*/ + GIMP_LAYER_MODE_EXCLUSION, /*< desc="Exclusion" >*/ + GIMP_LAYER_MODE_EXCLUSION_LINEAR, /*< desc="Exclusion (linear)" >*/ + GIMP_LAYER_MODE_LINEAR_BURN, /*< desc="Linear light" >*/ + GIMP_LAYER_MODE_LINEAR_BURN_LINEAR, /*< desc="Linear burn (linear)" >*/ /* Internal modes, not available to the PDB */ GIMP_LAYER_MODE_ERASE = 1000, /*< pdb-skip, desc="Erase" >*/ diff --git a/app/core/gimp-layer-modes.c b/app/core/gimp-layer-modes.c index b4508b399d..488e49348a 100644 --- a/app/core/gimp-layer-modes.c +++ b/app/core/gimp-layer-modes.c @@ -128,6 +128,11 @@ gimp_layer_mode_is_linear (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT: case GIMP_LAYER_MODE_GRAIN_EXTRACT: case GIMP_LAYER_MODE_GRAIN_MERGE: + case GIMP_LAYER_MODE_VIVID_LIGHT: + case GIMP_LAYER_MODE_PIN_LIGHT: + case GIMP_LAYER_MODE_LINEAR_LIGHT: + case GIMP_LAYER_MODE_EXCLUSION: + case GIMP_LAYER_MODE_LINEAR_BURN: return TRUE; case GIMP_LAYER_MODE_BEHIND_LINEAR: @@ -146,6 +151,11 @@ gimp_layer_mode_is_linear (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR: case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: + case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR: + case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR: + case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR: + case GIMP_LAYER_MODE_EXCLUSION_LINEAR: + case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR: return TRUE; case GIMP_LAYER_MODE_ERASE: @@ -158,7 +168,7 @@ gimp_layer_mode_is_linear (GimpLayerMode mode) return TRUE; } - return FALSE; + return TRUE; } GimpLayerColorSpace @@ -227,6 +237,11 @@ gimp_layer_mode_get_blend_space (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT: case GIMP_LAYER_MODE_GRAIN_EXTRACT: case GIMP_LAYER_MODE_GRAIN_MERGE: + case GIMP_LAYER_MODE_VIVID_LIGHT: + case GIMP_LAYER_MODE_PIN_LIGHT: + case GIMP_LAYER_MODE_LINEAR_LIGHT: + case GIMP_LAYER_MODE_EXCLUSION: + case GIMP_LAYER_MODE_LINEAR_BURN: return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL; case GIMP_LAYER_MODE_BEHIND_LINEAR: @@ -245,6 +260,11 @@ gimp_layer_mode_get_blend_space (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR: case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: + case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR: + case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR: + case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR: + case GIMP_LAYER_MODE_EXCLUSION_LINEAR: + case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR: return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR; case GIMP_LAYER_MODE_ERASE: @@ -328,6 +348,11 @@ gimp_layer_mode_get_composite_mode (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT: case GIMP_LAYER_MODE_GRAIN_EXTRACT: case GIMP_LAYER_MODE_GRAIN_MERGE: + case GIMP_LAYER_MODE_VIVID_LIGHT: + case GIMP_LAYER_MODE_PIN_LIGHT: + case GIMP_LAYER_MODE_LINEAR_LIGHT: + case GIMP_LAYER_MODE_EXCLUSION: + case GIMP_LAYER_MODE_LINEAR_BURN: return GIMP_LAYER_COMPOSITE_SRC_ATOP; case GIMP_LAYER_MODE_BEHIND_LINEAR: @@ -346,6 +371,11 @@ gimp_layer_mode_get_composite_mode (GimpLayerMode mode) case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR: case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: + case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR: + case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR: + case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR: + case GIMP_LAYER_MODE_EXCLUSION_LINEAR: + case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR: return GIMP_LAYER_COMPOSITE_SRC_ATOP; case GIMP_LAYER_MODE_ERASE: @@ -376,147 +406,64 @@ gimp_layer_mode_get_operation (GimpLayerMode mode) case GIMP_LAYER_MODE_MULTIPLY_LEGACY: return "gimp:multiply-legacy"; - case GIMP_LAYER_MODE_MULTIPLY: - case GIMP_LAYER_MODE_MULTIPLY_LINEAR: - return "gimp:multiply"; - case GIMP_LAYER_MODE_SCREEN_LEGACY: return "gimp:screen-legacy"; - case GIMP_LAYER_MODE_SCREEN: - case GIMP_LAYER_MODE_SCREEN_LINEAR: - return "gimp:screen"; - case GIMP_LAYER_MODE_OVERLAY_LEGACY: - return "gimp:softlight-legacy"; - case GIMP_LAYER_MODE_OVERLAY: - case GIMP_LAYER_MODE_OVERLAY_LINEAR: - return "gimp:overlay"; + return "gimp:softlight-legacy"; case GIMP_LAYER_MODE_DIFFERENCE_LEGACY: return "gimp:difference-legacy"; - case GIMP_LAYER_MODE_DIFFERENCE: - case GIMP_LAYER_MODE_DIFFERENCE_LINEAR: - return "gimp:difference"; - case GIMP_LAYER_MODE_ADDITION_LEGACY: return "gimp:addition-legacy"; - case GIMP_LAYER_MODE_ADDITION: - case GIMP_LAYER_MODE_ADDITION_LINEAR: - return "gimp:addition"; - case GIMP_LAYER_MODE_SUBTRACT_LEGACY: return "gimp:subtract-legacy"; - case GIMP_LAYER_MODE_SUBTRACT: - case GIMP_LAYER_MODE_SUBTRACT_LINEAR: - return "gimp:subtract"; - case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY: return "gimp:darken-only-legacy"; - case GIMP_LAYER_MODE_DARKEN_ONLY: - case GIMP_LAYER_MODE_DARKEN_ONLY_LINEAR: - return "gimp:darken-only"; - case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY: return "gimp:lighten-only-legacy"; - case GIMP_LAYER_MODE_LIGHTEN_ONLY: - case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR: - return "gimp:lighten-only"; - case GIMP_LAYER_MODE_HSV_HUE_LEGACY: return "gimp:hsv-hue-legacy"; - case GIMP_LAYER_MODE_HSV_HUE: - return "gimp:hsv-hue"; - case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY: return "gimp:hsv-saturation-legacy"; - case GIMP_LAYER_MODE_HSV_SATURATION: - return "gimp:hsv-saturation"; - case GIMP_LAYER_MODE_HSV_COLOR_LEGACY: return "gimp:hsv-color-legacy"; - case GIMP_LAYER_MODE_HSV_COLOR: - return "gimp:hsv-color"; - case GIMP_LAYER_MODE_HSV_VALUE_LEGACY: return "gimp:hsv-value-legacy"; - case GIMP_LAYER_MODE_HSV_VALUE: - return "gimp:hsv-value"; - case GIMP_LAYER_MODE_DIVIDE_LEGACY: return "gimp:divide-legacy"; - case GIMP_LAYER_MODE_DIVIDE: - case GIMP_LAYER_MODE_DIVIDE_LINEAR: - return "gimp:divide"; - case GIMP_LAYER_MODE_DODGE_LEGACY: return "gimp:dodge-legacy"; - case GIMP_LAYER_MODE_DODGE: - case GIMP_LAYER_MODE_DODGE_LINEAR: - return "gimp:dodge"; - case GIMP_LAYER_MODE_BURN_LEGACY: return "gimp:burn-legacy"; - case GIMP_LAYER_MODE_BURN: - case GIMP_LAYER_MODE_BURN_LINEAR: - return "gimp:burn"; - case GIMP_LAYER_MODE_HARDLIGHT_LEGACY: return "gimp:hardlight-legacy"; - case GIMP_LAYER_MODE_HARDLIGHT: - case GIMP_LAYER_MODE_HARDLIGHT_LINEAR: - return "gimp:hardlight"; - case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY: return "gimp:softlight-legacy"; - case GIMP_LAYER_MODE_SOFTLIGHT: - case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR: - return "gimp:softlight"; - case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY: return "gimp:grain-extract-legacy"; - case GIMP_LAYER_MODE_GRAIN_EXTRACT: - case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: - return "gimp:grain-extract"; - case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY: return "gimp:grain-merge-legacy"; - case GIMP_LAYER_MODE_GRAIN_MERGE: - case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: - return "gimp:grain-merge"; - case GIMP_LAYER_MODE_COLOR_ERASE: return "gimp:color-erase"; - case GIMP_LAYER_MODE_LCH_HUE: - return "gimp:lch-hue"; - - case GIMP_LAYER_MODE_LCH_CHROMA: - return "gimp:lch-chroma"; - - case GIMP_LAYER_MODE_LCH_COLOR: - return "gimp:lch-color"; - - case GIMP_LAYER_MODE_LCH_LIGHTNESS: - return "gimp:lch-lightness"; - case GIMP_LAYER_MODE_ERASE: return "gimp:erase"; @@ -525,7 +472,8 @@ gimp_layer_mode_get_operation (GimpLayerMode mode) case GIMP_LAYER_MODE_ANTI_ERASE: return "gimp:anti-erase"; + default: + return "gimp:layer-mode"; } - - return NULL; + return "gimp:layer-mode"; } diff --git a/app/operations/gimp-operations.c b/app/operations/gimp-operations.c index 4c394442e4..fc26091c89 100644 --- a/app/operations/gimp-operations.c +++ b/app/operations/gimp-operations.c @@ -84,36 +84,13 @@ #include "layer-modes-legacy/gimpoperationsoftlightlegacy.h" #include "layer-modes-legacy/gimpoperationsubtractlegacy.h" -#include "layer-modes/gimpoperationaddition.h" #include "layer-modes/gimpoperationantierase.h" #include "layer-modes/gimpoperationbehind.h" -#include "layer-modes/gimpoperationburn.h" -#include "layer-modes/gimpoperationcolorerase.h" -#include "layer-modes/gimpoperationdarkenonly.h" -#include "layer-modes/gimpoperationdifference.h" -#include "layer-modes/gimpoperationdissolve.h" -#include "layer-modes/gimpoperationdivide.h" -#include "layer-modes/gimpoperationdodge.h" #include "layer-modes/gimpoperationerase.h" -#include "layer-modes/gimpoperationgrainextract.h" -#include "layer-modes/gimpoperationgrainmerge.h" -#include "layer-modes/gimpoperationhardlight.h" -#include "layer-modes/gimpoperationhsvcolor.h" -#include "layer-modes/gimpoperationhsvhue.h" -#include "layer-modes/gimpoperationhsvsaturation.h" -#include "layer-modes/gimpoperationhsvvalue.h" -#include "layer-modes/gimpoperationlchchroma.h" -#include "layer-modes/gimpoperationlchcolor.h" -#include "layer-modes/gimpoperationlchhue.h" -#include "layer-modes/gimpoperationlchlightness.h" -#include "layer-modes/gimpoperationlightenonly.h" -#include "layer-modes/gimpoperationmultiply.h" +#include "layer-modes/gimpoperationcolorerase.h" +#include "layer-modes/gimpoperationdissolve.h" #include "layer-modes/gimpoperationnormal.h" -#include "layer-modes/gimpoperationoverlay.h" #include "layer-modes/gimpoperationreplace.h" -#include "layer-modes/gimpoperationscreen.h" -#include "layer-modes/gimpoperationsoftlight.h" -#include "layer-modes/gimpoperationsubtract.h" void @@ -150,48 +127,25 @@ gimp_operations_init (void) g_type_class_ref (GIMP_TYPE_OPERATION_NORMAL); g_type_class_ref (GIMP_TYPE_OPERATION_DISSOLVE); g_type_class_ref (GIMP_TYPE_OPERATION_BEHIND); - g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY); g_type_class_ref (GIMP_TYPE_OPERATION_MULTIPLY_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_SCREEN); g_type_class_ref (GIMP_TYPE_OPERATION_SCREEN_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_OVERLAY); - g_type_class_ref (GIMP_TYPE_OPERATION_DIFFERENCE); g_type_class_ref (GIMP_TYPE_OPERATION_DIFFERENCE_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION); g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT); g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY); g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY); g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE); - g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION); - g_type_class_ref (GIMP_TYPE_OPERATION_HSV_COLOR); - g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE); g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE_LEGACY); g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY); g_type_class_ref (GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY); g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_DIVIDE); g_type_class_ref (GIMP_TYPE_OPERATION_DIVIDE_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_DODGE); g_type_class_ref (GIMP_TYPE_OPERATION_DODGE_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_BURN); g_type_class_ref (GIMP_TYPE_OPERATION_BURN_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_HARDLIGHT); g_type_class_ref (GIMP_TYPE_OPERATION_HARDLIGHT_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_SOFTLIGHT); g_type_class_ref (GIMP_TYPE_OPERATION_SOFTLIGHT_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_EXTRACT); g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_EXTRACT_LEGACY); - g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_MERGE); g_type_class_ref (GIMP_TYPE_OPERATION_GRAIN_MERGE_LEGACY); g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_ERASE); - g_type_class_ref (GIMP_TYPE_OPERATION_LCH_HUE); - g_type_class_ref (GIMP_TYPE_OPERATION_LCH_CHROMA); - g_type_class_ref (GIMP_TYPE_OPERATION_LCH_COLOR); - g_type_class_ref (GIMP_TYPE_OPERATION_LCH_LIGHTNESS); g_type_class_ref (GIMP_TYPE_OPERATION_ERASE); g_type_class_ref (GIMP_TYPE_OPERATION_REPLACE); g_type_class_ref (GIMP_TYPE_OPERATION_ANTI_ERASE); diff --git a/app/operations/layer-modes/Makefile.am b/app/operations/layer-modes/Makefile.am index 55599304e7..cce47539ad 100644 --- a/app/operations/layer-modes/Makefile.am +++ b/app/operations/layer-modes/Makefile.am @@ -24,67 +24,20 @@ libapplayermodes_generic_a_sources = \ gimplayermodefunctions.h \ gimpblendcomposite.h \ \ - gimpoperationaddition.c \ - gimpoperationaddition.h \ gimpoperationantierase.c \ gimpoperationantierase.h \ gimpoperationbehind.c \ gimpoperationbehind.h \ - gimpoperationburn.c \ - gimpoperationburn.h \ gimpoperationcolorerase.c \ gimpoperationcolorerase.h \ - gimpoperationdarkenonly.c \ - gimpoperationdarkenonly.h \ - gimpoperationdifference.c \ - gimpoperationdifference.h \ gimpoperationdissolve.c \ gimpoperationdissolve.h \ - gimpoperationdivide.c \ - gimpoperationdivide.h \ - gimpoperationdodge.c \ - gimpoperationdodge.h \ gimpoperationerase.c \ gimpoperationerase.h \ - gimpoperationgrainextract.c \ - gimpoperationgrainextract.h \ - gimpoperationgrainmerge.c \ - gimpoperationgrainmerge.h \ - gimpoperationhardlight.c \ - gimpoperationhardlight.h \ - gimpoperationhsvcolor.c \ - gimpoperationhsvcolor.h \ - gimpoperationhsvhue.c \ - gimpoperationhsvhue.h \ - gimpoperationhsvsaturation.c \ - gimpoperationhsvsaturation.h \ - gimpoperationhsvvalue.c \ - gimpoperationhsvvalue.h \ - gimpoperationhsvvalue.h \ - gimpoperationlchchroma.c \ - gimpoperationlchchroma.h \ - gimpoperationlchcolor.c \ - gimpoperationlchcolor.h \ - gimpoperationlchhue.c \ - gimpoperationlchhue.h \ - gimpoperationlchlightness.c \ - gimpoperationlchlightness.h \ - gimpoperationlightenonly.c \ - gimpoperationlightenonly.h \ - gimpoperationmultiply.c \ - gimpoperationmultiply.h \ gimpoperationnormal.c \ gimpoperationnormal.h \ - gimpoperationoverlay.c \ - gimpoperationoverlay.h \ gimpoperationreplace.c \ - gimpoperationreplace.h \ - gimpoperationscreen.c \ - gimpoperationscreen.h \ - gimpoperationsoftlight.c \ - gimpoperationsoftlight.h \ - gimpoperationsubtract.c \ - gimpoperationsubtract.h + gimpoperationreplace.h libapplayermodes_sse2_a_sources = \ gimpoperationnormal-sse2.c diff --git a/app/operations/layer-modes/gimpblendcomposite.h b/app/operations/layer-modes/gimpblendcomposite.h deleted file mode 100644 index 1a0b555dde..0000000000 --- a/app/operations/layer-modes/gimpblendcomposite.h +++ /dev/null @@ -1,1271 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * gimpblendcomposite - * Copyright (C) 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_BLEND_COMPOSITE_H__ -#define __GIMP_BLEND_COMPOSITE_H__ - - -#include -#include - -#include "libgimpcolor/gimpcolor.h" -#include "libgimpmath/gimpmath.h" - - -extern const Babl *_gimp_fish_rgba_to_perceptual; -extern const Babl *_gimp_fish_perceptual_to_rgba; -extern const Babl *_gimp_fish_perceptual_to_laba; -extern const Babl *_gimp_fish_rgba_to_laba; -extern const Babl *_gimp_fish_laba_to_rgba; -extern const Babl *_gimp_fish_laba_to_perceptual; - - -static inline void -compfun_src_atop (gfloat *in, - gfloat *layer, - gfloat *mask, - gfloat opacity, - gfloat *out, - gint samples) -{ - while (samples--) - { - gfloat layer_alpha = layer[ALPHA] * opacity; - - if (mask) - layer_alpha *= *mask; - - if (layer_alpha == 0.0f) - { - out[RED] = in[RED]; - out[GREEN] = in[GREEN]; - out[BLUE] = in[BLUE]; - } - else - { - gint b; - - for (b = RED; b < ALPHA; b++) - out[b] = layer[b] * layer_alpha + in[b] * (1.0f - layer_alpha); - } - - out[ALPHA] = in[ALPHA]; - - in += 4; - out += 4; - layer += 4; - - if (mask) - mask++; - } -} - -static inline void -compfun_src_over (gfloat *in, - gfloat *layer, - gfloat *comp, - gfloat *mask, - gfloat opacity, - gfloat *out, - gint samples) -{ - while (samples--) - { - gfloat new_alpha; - gfloat layer_alpha = layer[ALPHA] * opacity; - - if (mask) - layer_alpha *= *mask; - - new_alpha = layer_alpha + (1.0f - layer_alpha) * in[ALPHA]; - - if (layer_alpha == 0.0f || new_alpha == 0.0f) - { - out[RED] = in[RED]; - out[GREEN] = in[GREEN]; - out[BLUE] = in[BLUE]; - } - else - { - gfloat ratio = layer_alpha / new_alpha; - gint b; - - for (b = RED; b < ALPHA; b++) - out[b] = ratio * (in[ALPHA] * (comp[b] - layer[b]) + layer[b] - in[b]) + in[b]; - } - - out[ALPHA] = new_alpha; - - in += 4; - layer += 4; - comp += 4; - out += 4; - - if (mask) - mask++; - } -} - -static inline void -compfun_dst_atop (gfloat *in, - gfloat *layer, - gfloat *comp, - gfloat *mask, - gfloat opacity, - gfloat *out, - gint samples) -{ - while (samples--) - { - gfloat layer_alpha = layer[ALPHA] * opacity; - - if (mask) - layer_alpha *= *mask; - - if (layer_alpha == 0.0f) - { - out[RED] = in[RED]; - out[GREEN] = in[GREEN]; - out[BLUE] = in[BLUE]; - } - else - { - gint b; - - for (b = RED; b < ALPHA; b++) - out[b] = comp[b] * in[ALPHA] + layer[b] * (1.0f - in[ALPHA]); - } - - out[ALPHA] = layer_alpha; - - in += 4; - layer += 4; - comp += 4; - out += 4; - - if (mask) - mask++; - } -} - -static inline void -compfun_src_in (gfloat *in, - gfloat *layer, - gfloat *mask, - gfloat opacity, - gfloat *out, - gint samples) -{ - while (samples--) - { - gfloat new_alpha = in[ALPHA] * layer[ALPHA] * opacity; - - if (mask) - new_alpha *= *mask; - - if (new_alpha == 0.0f) - { - out[RED] = in[RED]; - out[GREEN] = in[GREEN]; - out[BLUE] = in[BLUE]; - } - else - { - out[RED] = layer[RED]; - out[GREEN] = layer[GREEN]; - out[BLUE] = layer[BLUE]; - } - - out[ALPHA] = new_alpha; - - in += 4; - out += 4; - layer += 4; - - if (mask) - mask++; - } -} - -static inline void -gimp_composite_blend (gpointer op, - gfloat *in, - gfloat *layer, - gfloat *mask, - gfloat *out, - glong samples, - GimpBlendFunc blend_func) -{ - GimpOperationLayerMode *layer_mode = op; - gfloat opacity = layer_mode->opacity; - GimpLayerColorSpace blend_space = layer_mode->blend_space; - GimpLayerColorSpace composite_space= layer_mode->composite_space; - GimpLayerCompositeMode composite_mode = layer_mode->composite_mode; - - gfloat *blend_in = in; - gfloat *blend_layer = layer; - gfloat *blend_out = out; - - gfloat *composite_in = NULL; - gfloat *composite_layer = NULL; - - gboolean composite_needs_in_color = - composite_mode == GIMP_LAYER_COMPOSITE_SRC_OVER || - composite_mode == GIMP_LAYER_COMPOSITE_SRC_ATOP; - gboolean composite_needs_layer_color = - composite_mode == GIMP_LAYER_COMPOSITE_SRC_OVER || - composite_mode == GIMP_LAYER_COMPOSITE_DST_ATOP; - - const Babl *fish_to_blend = NULL; - const Babl *fish_to_composite = NULL; - const Babl *fish_from_composite = NULL; - - switch (blend_space) - { - default: - case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: - fish_to_blend = NULL; - switch (composite_space) - { - case GIMP_LAYER_COLOR_SPACE_LAB: - fish_to_composite = _gimp_fish_rgba_to_laba; - fish_from_composite = _gimp_fish_laba_to_rgba; - break; - default: - case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: - fish_to_composite = NULL; - fish_from_composite = NULL; - break; - case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: - fish_to_composite = _gimp_fish_rgba_to_perceptual; - fish_from_composite = _gimp_fish_perceptual_to_rgba; - break; - } - break; - - case GIMP_LAYER_COLOR_SPACE_LAB: - fish_to_blend = _gimp_fish_rgba_to_laba; - switch (composite_space) - { - case GIMP_LAYER_COLOR_SPACE_LAB: - default: - fish_to_composite = NULL; - fish_from_composite = _gimp_fish_laba_to_rgba; - break; - case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: - fish_to_composite = _gimp_fish_laba_to_rgba; - fish_from_composite = NULL; - break; - case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: - fish_to_composite = _gimp_fish_laba_to_perceptual; - fish_from_composite = _gimp_fish_perceptual_to_rgba; - break; - } - break; - - case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: - fish_to_blend = _gimp_fish_rgba_to_perceptual; - switch (composite_space) - { - case GIMP_LAYER_COLOR_SPACE_LAB: - default: - fish_to_composite = _gimp_fish_perceptual_to_laba; - fish_from_composite = NULL; - break; - case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: - fish_to_composite = _gimp_fish_perceptual_to_rgba; - fish_from_composite = NULL; - break; - case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: - fish_to_composite = NULL; - fish_from_composite = _gimp_fish_perceptual_to_rgba; - break; - } - break; - } - - if (in == out) /* in-place detected, avoid clobbering since we need to - read it for the compositing stage */ - blend_out = g_alloca (sizeof (gfloat) * 4 * samples); - - if (fish_to_blend) - { - if (in != out || (composite_needs_in_color && - composite_space == GIMP_LAYER_COLOR_SPACE_RGB_LINEAR)) - { - /* don't convert input in-place if we're not doing in-place output, - * or if we're going to need the original input for compositing. - */ - blend_in = g_alloca (sizeof (gfloat) * 4 * samples); - } - blend_layer = g_alloca (sizeof (gfloat) * 4 * samples); - - babl_process (fish_to_blend, in, blend_in, samples); - babl_process (fish_to_blend, layer, blend_layer, samples); - } - - blend_func (blend_in, blend_layer, blend_out, samples); - - composite_in = blend_in; - composite_layer = blend_layer; - - if (fish_to_composite) - { - if (composite_space == GIMP_LAYER_COLOR_SPACE_RGB_LINEAR) - { - composite_in = in; - composite_layer = layer; - } - else - { - if (composite_needs_in_color) - { - if (composite_in == in && in != out) - composite_in = g_alloca (sizeof (gfloat) * 4 * samples); - - babl_process (fish_to_composite, - blend_in, composite_in, samples); - } - - if (composite_needs_layer_color) - { - if (composite_layer == layer) - composite_layer = g_alloca (sizeof (gfloat) * 4 * samples); - - babl_process (fish_to_composite, - blend_layer, composite_layer, samples); - } - } - - babl_process (fish_to_composite, blend_out, blend_out, samples); - } - - switch (composite_mode) - { - case GIMP_LAYER_COMPOSITE_SRC_ATOP: - default: - compfun_src_atop (composite_in, blend_out, mask, opacity, out, samples); - break; - - case GIMP_LAYER_COMPOSITE_SRC_OVER: - compfun_src_over (composite_in, composite_layer, blend_out, mask, opacity, out, samples); - break; - - case GIMP_LAYER_COMPOSITE_DST_ATOP: - compfun_dst_atop (composite_in, composite_layer, blend_out, mask, opacity, out, samples); - break; - - case GIMP_LAYER_COMPOSITE_SRC_IN: - compfun_src_in (composite_in, blend_out, mask, opacity, out, samples); - break; - } - - if (fish_from_composite) - { - babl_process (fish_from_composite, out, out, samples); - } -} - -static inline void -blendfun_screen (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = 1.0f - (1.0f - dest[c]) * (1.0f - src[c]); - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void /* aka linear_dodge */ -blendfun_addition (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] + src[c]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - - -static inline void -blendfun_linear_burn (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] + src[c] - 1.0f; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_subtract (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] - src[c]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_multiply (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] * src[c]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_normal (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = src[c]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_burn (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp = 1.0f - (1.0f - dest[c]) / src[c]; - - /* The CLAMP macro is deliberately inlined and written - * to map comp == NAN (0 / 0) -> 1 - */ - out[c] = comp < 0 ? 0.0f : comp < 1.0f ? comp : 1.0f; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_darken_only (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = MIN (dest[c], src[c]); - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_lighten_only (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = MAX (dest[c], src[c]); - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_difference (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - out[c] = dest[c] - src[c]; - - if (out[c] < 0) - out[c] = -out[c]; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_divide (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp = dest[c] / src[c]; - - /* make infinities(or NaN) correspond to a high number, - * to get more predictable math, ideally higher than 5.0 - * but it seems like some babl conversions might be - * acting up then - */ - if (!(comp > -42949672.0f && comp < 5.0f)) - comp = 5.0f; - - out[c] = comp; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_dodge (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp = dest[c] / (1.0f - src[c]); - - comp = MIN (comp, 1.0f); - - out[c] = comp; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_grain_extract (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] - src[c] + 0.5f; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_grain_merge (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - out[c] = dest[c] + src[c] - 0.5f; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_hardlight (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp; - - if (src[c] > 0.5f) - { - comp = (1.0f - dest[c]) * (1.0f - (src[c] - 0.5f) * 2.0f); - comp = MIN (1 - comp, 1); - } - else - { - comp = dest[c] * (src[c] * 2.0f); - comp = MIN (comp, 1.0f); - } - - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_softlight (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat multiply = dest[c] * src[c]; - gfloat screen = 1.0f - (1.0f - dest[c]) * (1.0f - src[c]); - gfloat comp = (1.0f - dest[c]) * multiply + dest[c] * screen; - - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_overlay (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp; - - if (src[c] < 0.5f) - { - comp = 2.0f * dest[c] * src[c]; - } - else - { - comp = 1.0f - 2.0f * (1.0f - src[c]) * (1.0f - dest[c]); - } - - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_hsv_color (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; - GimpRGB src_rgb = { src[0], src[1], src[2] }; - GimpHSL src_hsl, dest_hsl; - - gimp_rgb_to_hsl (&dest_rgb, &dest_hsl); - gimp_rgb_to_hsl (&src_rgb, &src_hsl); - - dest_hsl.h = src_hsl.h; - dest_hsl.s = src_hsl.s; - - gimp_hsl_to_rgb (&dest_hsl, &dest_rgb); - - out[RED] = dest_rgb.r; - out[GREEN] = dest_rgb.g; - out[BLUE] = dest_rgb.b; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_hsv_hue (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; - GimpRGB src_rgb = { src[0], src[1], src[2] }; - GimpHSV src_hsv, dest_hsv; - - gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); - gimp_rgb_to_hsv (&src_rgb, &src_hsv); - - dest_hsv.h = src_hsv.h; - gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); - - out[RED] = dest_rgb.r; - out[GREEN] = dest_rgb.g; - out[BLUE] = dest_rgb.b; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_hsv_saturation (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; - GimpRGB src_rgb = { src[0], src[1], src[2] }; - GimpHSV src_hsv, dest_hsv; - - gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); - gimp_rgb_to_hsv (&src_rgb, &src_hsv); - - dest_hsv.s = src_hsv.s; - gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); - - out[RED] = dest_rgb.r; - out[GREEN] = dest_rgb.g; - out[BLUE] = dest_rgb.b; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_hsv_value (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; - GimpRGB src_rgb = { src[0], src[1], src[2] }; - GimpHSV src_hsv, dest_hsv; - - gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); - gimp_rgb_to_hsv (&src_rgb, &src_hsv); - - dest_hsv.v = src_hsv.v; - gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); - - out[RED] = dest_rgb.r; - out[GREEN] = dest_rgb.g; - out[BLUE] = dest_rgb.b; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_lch_chroma (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gfloat A1 = dest[1]; - gfloat B1 = dest[2]; - gfloat c1 = hypotf (A1, B1); - - if (c1 != 0.0f) - { - gfloat A2 = src[1]; - gfloat B2 = src[2]; - gfloat c2 = hypotf (A2, B2); - gfloat A = c2 * A1 / c1; - gfloat B = c2 * B1 / c1; - - out[0] = dest[0]; - out[1] = A; - out[2] = B; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_lch_color (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - out[0] = dest[0]; - out[1] = src[1]; - out[2] = src[2]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_lch_hue (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gfloat A2 = src[1]; - gfloat B2 = src[2]; - gfloat c2 = hypotf (A2, B2); - - if (c2 > 0.1f) - { - gfloat A1 = dest[1]; - gfloat B1 = dest[2]; - gfloat c1 = hypotf (A1, B1); - gfloat A = c1 * A2 / c2; - gfloat B = c1 * B2 / c2; - - out[0] = dest[0]; - out[1] = A; - out[2] = B; - } - else - { - out[0] = dest[0]; - out[1] = dest[1]; - out[2] = dest[2]; - } - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_lch_lightness (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - out[0] = src[0]; - out[1] = dest[1]; - out[2] = dest[2]; - } - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - - -static inline void -blendfun_copy (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - gint c; - for (c = 0; c < 4; c++) - out[c] = src[c]; - - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -/* added according to: - http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ -static inline void -blendfun_vivid_light (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp; - - if (src[c] > 0.5f) - { - comp = (1.0f - (1.0f - dest[c]) / (2.0f * (src[c]))); - } - else - { - comp = dest[c] / (1.0f - 2.0f * (src[c] - 0.5)); - } - comp = MIN (comp, 1.0f); - - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - - -/* added according to: - http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ -static inline void -blendfun_linear_light (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp; - if (src[c] > 0.5f) - { - comp = dest[c] + 2.0 * (src[c] - 0.5); - } - else - { - comp = dest[c] + 2.0 * src[c] - 1.0; - } - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - - -/* added according to: - http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ -static inline void -blendfun_pin_light (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - gfloat comp; - if (src[c] > 0.5f) - { - comp = MAX(dest[c], 2 * (src[c] - 0.5)); - } - else - { - comp = MIN(dest[c], 2 * src[c]); - } - out[c] = comp; - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -static inline void -blendfun_exclusion (const float *dest, - const float *src, - float *out, - int samples) -{ - while (samples--) - { - if (src[ALPHA] != 0.0f) - { - gint c; - - for (c = 0; c < 3; c++) - { - out[c] = 0.5f - 2.0f * (dest[c] - 0.5f) * (src[c] - 0.5f); - } - } - out[ALPHA] = src[ALPHA]; - - out += 4; - src += 4; - dest += 4; - } -} - -#endif /* __GIMP_BLEND_COMPOSITE_H__ */ diff --git a/app/operations/layer-modes/gimplayermodefunctions.c b/app/operations/layer-modes/gimplayermodefunctions.c index 3bc190e39c..2b3ac630a7 100644 --- a/app/operations/layer-modes/gimplayermodefunctions.c +++ b/app/operations/layer-modes/gimplayermodefunctions.c @@ -45,42 +45,19 @@ #include "operations/layer-modes-legacy/gimpoperationsoftlightlegacy.h" #include "operations/layer-modes-legacy/gimpoperationsubtractlegacy.h" -#include "gimpoperationaddition.h" #include "gimpoperationantierase.h" #include "gimpoperationbehind.h" -#include "gimpoperationburn.h" #include "gimpoperationcolorerase.h" -#include "gimpoperationdarkenonly.h" -#include "gimpoperationdifference.h" #include "gimpoperationdissolve.h" -#include "gimpoperationdivide.h" -#include "gimpoperationdodge.h" #include "gimpoperationerase.h" -#include "gimpoperationgrainextract.h" -#include "gimpoperationgrainmerge.h" -#include "gimpoperationhardlight.h" -#include "gimpoperationhsvcolor.h" -#include "gimpoperationhsvhue.h" -#include "gimpoperationhsvsaturation.h" -#include "gimpoperationhsvvalue.h" -#include "gimpoperationlchchroma.h" -#include "gimpoperationlchcolor.h" -#include "gimpoperationlchhue.h" -#include "gimpoperationlchlightness.h" -#include "gimpoperationlightenonly.h" -#include "gimpoperationmultiply.h" #include "gimpoperationnormal.h" -#include "gimpoperationoverlay.h" #include "gimpoperationreplace.h" -#include "gimpoperationscreen.h" -#include "gimpoperationsoftlight.h" -#include "gimpoperationsubtract.h" GimpLayerModeFunc gimp_get_layer_mode_function (GimpLayerMode paint_mode) { - GimpLayerModeFunc func; + GimpLayerModeFunc func = gimp_operation_layer_mode_process_pixels; switch (paint_mode) { @@ -102,19 +79,10 @@ gimp_get_layer_mode_function (GimpLayerMode paint_mode) func = gimp_operation_multiply_legacy_process; break; - case GIMP_LAYER_MODE_MULTIPLY: - case GIMP_LAYER_MODE_MULTIPLY_LINEAR: - func = gimp_operation_multiply_process; - break; - case GIMP_LAYER_MODE_SCREEN_LEGACY: func = gimp_operation_screen_legacy_process; break; - case GIMP_LAYER_MODE_SCREEN: - func = gimp_operation_screen_process; - break; - case GIMP_LAYER_MODE_OVERLAY_LEGACY: func = gimp_operation_softlight_legacy_process; break; @@ -123,75 +91,34 @@ gimp_get_layer_mode_function (GimpLayerMode paint_mode) func = gimp_operation_difference_legacy_process; break; - case GIMP_LAYER_MODE_DIFFERENCE: - case GIMP_LAYER_MODE_DIFFERENCE_LINEAR: - func = gimp_operation_difference_process; - break; - case GIMP_LAYER_MODE_ADDITION_LEGACY: func = gimp_operation_addition_legacy_process; break; - case GIMP_LAYER_MODE_ADDITION: - case GIMP_LAYER_MODE_ADDITION_LINEAR: - func = gimp_operation_addition_process; - break; - case GIMP_LAYER_MODE_SUBTRACT_LEGACY: func = gimp_operation_subtract_legacy_process; break; - case GIMP_LAYER_MODE_SUBTRACT: - case GIMP_LAYER_MODE_SUBTRACT_LINEAR: - func = gimp_operation_subtract_process; - break; - case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY: func = gimp_operation_darken_only_legacy_process; break; - case GIMP_LAYER_MODE_DARKEN_ONLY: - case GIMP_LAYER_MODE_DARKEN_ONLY_LINEAR: - func = gimp_operation_darken_only_process; - break; - case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY: func = gimp_operation_lighten_only_legacy_process; break; - case GIMP_LAYER_MODE_LIGHTEN_ONLY: - case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR: - func = gimp_operation_lighten_only_process; - break; - - case GIMP_LAYER_MODE_HSV_HUE: - func = gimp_operation_hsv_hue_process; - break; - case GIMP_LAYER_MODE_HSV_HUE_LEGACY: func = gimp_operation_hsv_hue_legacy_process; break; - case GIMP_LAYER_MODE_HSV_SATURATION: - func = gimp_operation_hsv_saturation_process; - break; - case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY: func = gimp_operation_hsv_saturation_legacy_process; break; - case GIMP_LAYER_MODE_HSV_COLOR: - func = gimp_operation_hsv_color_process; - break; - case GIMP_LAYER_MODE_HSV_COLOR_LEGACY: func = gimp_operation_hsv_color_legacy_process; break; - case GIMP_LAYER_MODE_HSV_VALUE: - func = gimp_operation_hsv_value_process; - break; - case GIMP_LAYER_MODE_HSV_VALUE_LEGACY: func = gimp_operation_hsv_value_legacy_process; break; @@ -200,87 +127,34 @@ gimp_get_layer_mode_function (GimpLayerMode paint_mode) func = gimp_operation_divide_legacy_process; break; - case GIMP_LAYER_MODE_DIVIDE: - case GIMP_LAYER_MODE_DIVIDE_LINEAR: - func = gimp_operation_divide_process; - break; - case GIMP_LAYER_MODE_DODGE_LEGACY: func = gimp_operation_dodge_legacy_process; break; - case GIMP_LAYER_MODE_DODGE: - case GIMP_LAYER_MODE_DODGE_LINEAR: - func = gimp_operation_dodge_process; - break; - case GIMP_LAYER_MODE_BURN_LEGACY: func = gimp_operation_burn_legacy_process; break; - case GIMP_LAYER_MODE_BURN: - case GIMP_LAYER_MODE_BURN_LINEAR: - func = gimp_operation_burn_process; - break; - case GIMP_LAYER_MODE_HARDLIGHT_LEGACY: func = gimp_operation_hardlight_legacy_process; break; - case GIMP_LAYER_MODE_HARDLIGHT: - func = gimp_operation_hardlight_process; - break; - case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY: func = gimp_operation_softlight_legacy_process; break; - case GIMP_LAYER_MODE_SOFTLIGHT: - func = gimp_operation_softlight_process; - break; - case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY: func = gimp_operation_grain_extract_legacy_process; break; - case GIMP_LAYER_MODE_GRAIN_EXTRACT: - case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: - func = gimp_operation_grain_extract_process; - break; - case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY: func = gimp_operation_grain_merge_legacy_process; break; - case GIMP_LAYER_MODE_GRAIN_MERGE: - case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: - func = gimp_operation_grain_merge_process; - break; - case GIMP_LAYER_MODE_COLOR_ERASE: func = gimp_operation_color_erase_process; break; - case GIMP_LAYER_MODE_OVERLAY: - func = gimp_operation_overlay_process; - break; - - case GIMP_LAYER_MODE_LCH_HUE: - func = gimp_operation_lch_hue_process; - break; - - case GIMP_LAYER_MODE_LCH_CHROMA: - func = gimp_operation_lch_chroma_process; - break; - - case GIMP_LAYER_MODE_LCH_COLOR: - func = gimp_operation_lch_color_process; - break; - - case GIMP_LAYER_MODE_LCH_LIGHTNESS: - func = gimp_operation_lch_lightness_process; - break; - case GIMP_LAYER_MODE_ERASE: func = gimp_operation_erase_process; break; @@ -294,9 +168,6 @@ gimp_get_layer_mode_function (GimpLayerMode paint_mode) break; default: - g_warning ("No direct function for layer mode (%d), using gimp:normal", - paint_mode); - func = gimp_operation_normal_process; break; } diff --git a/app/operations/layer-modes/gimpoperationaddition.c b/app/operations/layer-modes/gimpoperationaddition.c deleted file mode 100644 index a7f2b51228..0000000000 --- a/app/operations/layer-modes/gimpoperationaddition.c +++ /dev/null @@ -1,73 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationadditionmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationaddition.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationAddition, gimp_operation_addition, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_addition_class_init (GimpOperationAdditionClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:addition", - "description", "GIMP addition mode operation", - NULL); - - point_class->process = gimp_operation_addition_process; -} - -static void -gimp_operation_addition_init (GimpOperationAddition *self) -{ -} - -gboolean -gimp_operation_addition_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_addition); - - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationaddition.h b/app/operations/layer-modes/gimpoperationaddition.h deleted file mode 100644 index 53d23cbc75..0000000000 --- a/app/operations/layer-modes/gimpoperationaddition.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationaddition.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_ADDITION_H__ -#define __GIMP_OPERATION_ADDITION_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_ADDITION (gimp_operation_addition_get_type ()) -#define GIMP_OPERATION_ADDITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_ADDITION, GimpOperationAddition)) -#define GIMP_OPERATION_ADDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_ADDITION, GimpOperationAdditionClass)) -#define GIMP_IS_OPERATION_ADDITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_ADDITION)) -#define GIMP_IS_OPERATION_ADDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_ADDITION)) -#define GIMP_OPERATION_ADDITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_ADDITION, GimpOperationAdditionClass)) - - -typedef struct _GimpOperationAddition GimpOperationAddition; -typedef struct _GimpOperationAdditionClass GimpOperationAdditionClass; - -struct _GimpOperationAddition -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationAdditionClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_addition_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_addition_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_ADDITION_H__ */ diff --git a/app/operations/layer-modes/gimpoperationburn.c b/app/operations/layer-modes/gimpoperationburn.c deleted file mode 100644 index 943a9598b7..0000000000 --- a/app/operations/layer-modes/gimpoperationburn.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationburnmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationburn.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationBurn, gimp_operation_burn, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_burn_class_init (GimpOperationBurnClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:burn", - "description", "GIMP burn mode operation", - NULL); - - point_class->process = gimp_operation_burn_process; -} - -static void -gimp_operation_burn_init (GimpOperationBurn *self) -{ -} - -gboolean -gimp_operation_burn_process (GeglOperation *operation, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (operation, in, layer, mask, out, samples, - blendfun_burn); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationburn.h b/app/operations/layer-modes/gimpoperationburn.h deleted file mode 100644 index 08db05fd5d..0000000000 --- a/app/operations/layer-modes/gimpoperationburn.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationburn.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_BURN_H__ -#define __GIMP_OPERATION_BURN_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_BURN (gimp_operation_burn_get_type ()) -#define GIMP_OPERATION_BURN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_BURN, GimpOperationBurn)) -#define GIMP_OPERATION_BURN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_BURN, GimpOperationBurnClass)) -#define GIMP_IS_OPERATION_BURN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_BURN)) -#define GIMP_IS_OPERATION_BURN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_BURN)) -#define GIMP_OPERATION_BURN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_BURN, GimpOperationBurnClass)) - - -typedef struct _GimpOperationBurn GimpOperationBurn; -typedef struct _GimpOperationBurnClass GimpOperationBurnClass; - -struct _GimpOperationBurn -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationBurnClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_burn_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_burn_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_BURN_H__ */ diff --git a/app/operations/layer-modes/gimpoperationdarkenonly.c b/app/operations/layer-modes/gimpoperationdarkenonly.c deleted file mode 100644 index 1565f27535..0000000000 --- a/app/operations/layer-modes/gimpoperationdarkenonly.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdarkenonlymode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationdarkenonly.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationDarkenOnly, gimp_operation_darken_only, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_darken_only_class_init (GimpOperationDarkenOnlyClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:darken-only", - "description", "GIMP darken only mode operation", - NULL); - - point_class->process = gimp_operation_darken_only_process; -} - -static void -gimp_operation_darken_only_init (GimpOperationDarkenOnly *self) -{ -} - -gboolean -gimp_operation_darken_only_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_darken_only); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationdarkenonly.h b/app/operations/layer-modes/gimpoperationdarkenonly.h deleted file mode 100644 index d964dc0949..0000000000 --- a/app/operations/layer-modes/gimpoperationdarkenonly.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdarkenonly.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_DARKEN_ONLY_H__ -#define __GIMP_OPERATION_DARKEN_ONLY_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_DARKEN_ONLY (gimp_operation_darken_only_get_type ()) -#define GIMP_OPERATION_DARKEN_ONLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnly)) -#define GIMP_OPERATION_DARKEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyClass)) -#define GIMP_IS_OPERATION_DARKEN_ONLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE)) -#define GIMP_IS_OPERATION_DARKEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE)) -#define GIMP_OPERATION_DARKEN_ONLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyClass)) - - -typedef struct _GimpOperationDarkenOnly GimpOperationDarkenOnly; -typedef struct _GimpOperationDarkenOnlyClass GimpOperationDarkenOnlyClass; - -struct _GimpOperationDarkenOnly -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationDarkenOnlyClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_darken_only_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_darken_only_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_DARKEN_ONLY_H__ */ diff --git a/app/operations/layer-modes/gimpoperationdifference.c b/app/operations/layer-modes/gimpoperationdifference.c deleted file mode 100644 index 084c873216..0000000000 --- a/app/operations/layer-modes/gimpoperationdifference.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdifferencemode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationdifference.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationDifference, gimp_operation_difference, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_difference_class_init (GimpOperationDifferenceClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:difference", - "description", "GIMP difference mode operation", - NULL); - - point_class->process = gimp_operation_difference_process; -} - -static void -gimp_operation_difference_init (GimpOperationDifference *self) -{ -} - -gboolean -gimp_operation_difference_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_difference); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationdifference.h b/app/operations/layer-modes/gimpoperationdifference.h deleted file mode 100644 index 0817368ff9..0000000000 --- a/app/operations/layer-modes/gimpoperationdifference.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdifference.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_DIFFERENCE_H__ -#define __GIMP_OPERATION_DIFFERENCE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_DIFFERENCE (gimp_operation_difference_get_type ()) -#define GIMP_OPERATION_DIFFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_DIFFERENCE, GimpOperationDifference)) -#define GIMP_OPERATION_DIFFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_DIFFERENCE, GimpOperationDifferenceClass)) -#define GIMP_IS_OPERATION_DIFFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_DIFFERENCE)) -#define GIMP_IS_OPERATION_DIFFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_DIFFERENCE)) -#define GIMP_OPERATION_DIFFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_DIFFERENCE, GimpOperationDifferenceClass)) - - -typedef struct _GimpOperationDifference GimpOperationDifference; -typedef struct _GimpOperationDifferenceClass GimpOperationDifferenceClass; - -struct _GimpOperationDifference -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationDifferenceClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_difference_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_difference_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_DIFFERENCE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationdivide.c b/app/operations/layer-modes/gimpoperationdivide.c deleted file mode 100644 index b7d11af4a5..0000000000 --- a/app/operations/layer-modes/gimpoperationdivide.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdividemode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationdivide.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationDivide, gimp_operation_divide, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_divide_class_init (GimpOperationDivideClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:divide", - "description", "GIMP divide mode operation", - NULL); - - point_class->process = gimp_operation_divide_process; -} - -static void -gimp_operation_divide_init (GimpOperationDivide *self) -{ -} - -gboolean -gimp_operation_divide_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_divide); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationdivide.h b/app/operations/layer-modes/gimpoperationdivide.h deleted file mode 100644 index 70a6dabd72..0000000000 --- a/app/operations/layer-modes/gimpoperationdivide.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdivide.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_DIVIDE_H__ -#define __GIMP_OPERATION_DIVIDE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_DIVIDE (gimp_operation_divide_get_type ()) -#define GIMP_OPERATION_DIVIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_DIVIDE, GimpOperationDivide)) -#define GIMP_OPERATION_DIVIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_DIVIDE, GimpOperationDivideClass)) -#define GIMP_IS_OPERATION_DIVIDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_DIVIDE)) -#define GIMP_IS_OPERATION_DIVIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_DIVIDE)) -#define GIMP_OPERATION_DIVIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_DIVIDE, GimpOperationDivideClass)) - - -typedef struct _GimpOperationDivide GimpOperationDivide; -typedef struct _GimpOperationDivideClass GimpOperationDivideClass; - -struct _GimpOperationDivide -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationDivideClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_divide_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_divide_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_DIVIDE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationdodge.c b/app/operations/layer-modes/gimpoperationdodge.c deleted file mode 100644 index 2365cf19c2..0000000000 --- a/app/operations/layer-modes/gimpoperationdodge.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdodge.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "operations/operations-types.h" - -#include "gimpoperationdodge.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationDodge, gimp_operation_dodge, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_dodge_class_init (GimpOperationDodgeClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:dodge", - "description", "GIMP dodge mode operation", - NULL); - - point_class->process = gimp_operation_dodge_process; -} - -static void -gimp_operation_dodge_init (GimpOperationDodge *self) -{ -} - -gboolean -gimp_operation_dodge_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_dodge); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationdodge.h b/app/operations/layer-modes/gimpoperationdodge.h deleted file mode 100644 index 8a8bfb2c0d..0000000000 --- a/app/operations/layer-modes/gimpoperationdodge.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationdodge.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_DODGE_H__ -#define __GIMP_OPERATION_DODGE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_DODGE (gimp_operation_dodge_get_type ()) -#define GIMP_OPERATION_DODGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_DODGE, GimpOperationDodge)) -#define GIMP_OPERATION_DODGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_DODGE, GimpOperationDodgeClass)) -#define GIMP_IS_OPERATION_DODGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_DODGE)) -#define GIMP_IS_OPERATION_DODGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_DODGE)) -#define GIMP_OPERATION_DODGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_DODGE, GimpOperationDodgeClass)) - - -typedef struct _GimpOperationDodge GimpOperationDodge; -typedef struct _GimpOperationDodgeClass GimpOperationDodgeClass; - -struct _GimpOperationDodge -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationDodgeClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_dodge_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_dodge_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_DODGE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationgrainextract.c b/app/operations/layer-modes/gimpoperationgrainextract.c deleted file mode 100644 index 8e226c1357..0000000000 --- a/app/operations/layer-modes/gimpoperationgrainextract.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationgrainextractmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationgrainextract.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationGrainExtract, gimp_operation_grain_extract, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_grain_extract_class_init (GimpOperationGrainExtractClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:grain-extract", - "description", "GIMP grain extract mode operation", - NULL); - - point_class->process = gimp_operation_grain_extract_process; -} - -static void -gimp_operation_grain_extract_init (GimpOperationGrainExtract *self) -{ -} - -gboolean -gimp_operation_grain_extract_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_grain_extract); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationgrainextract.h b/app/operations/layer-modes/gimpoperationgrainextract.h deleted file mode 100644 index b3b2a7508c..0000000000 --- a/app/operations/layer-modes/gimpoperationgrainextract.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationgrainextract.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_GRAIN_EXTRACT_H__ -#define __GIMP_OPERATION_GRAIN_EXTRACT_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_GRAIN_EXTRACT (gimp_operation_grain_extract_get_type ()) -#define GIMP_OPERATION_GRAIN_EXTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_GRAIN_EXTRACT, GimpOperationGrainExtract)) -#define GIMP_OPERATION_GRAIN_EXTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_GRAIN_EXTRACT, GimpOperationGrainExtractClass)) -#define GIMP_IS_OPERATION_GRAIN_EXTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_GRAIN_EXTRACT)) -#define GIMP_IS_OPERATION_GRAIN_EXTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_GRAIN_EXTRACT)) -#define GIMP_OPERATION_GRAIN_EXTRACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_GRAIN_EXTRACT, GimpOperationGrainExtractClass)) - - -typedef struct _GimpOperationGrainExtract GimpOperationGrainExtract; -typedef struct _GimpOperationGrainExtractClass GimpOperationGrainExtractClass; - -struct _GimpOperationGrainExtract -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationGrainExtractClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_grain_extract_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_grain_extract_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_GRAIN_EXTRACT_H__ */ diff --git a/app/operations/layer-modes/gimpoperationgrainmerge.c b/app/operations/layer-modes/gimpoperationgrainmerge.c deleted file mode 100644 index 581daf35b9..0000000000 --- a/app/operations/layer-modes/gimpoperationgrainmerge.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationgrainmergemode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationgrainmerge.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationGrainMerge, gimp_operation_grain_merge, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_grain_merge_class_init (GimpOperationGrainMergeClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:grain-merge", - "description", "GIMP grain merge mode operation", - NULL); - - point_class->process = gimp_operation_grain_merge_process; -} - -static void -gimp_operation_grain_merge_init (GimpOperationGrainMerge *self) -{ -} - -gboolean -gimp_operation_grain_merge_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_grain_merge); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationgrainmerge.h b/app/operations/layer-modes/gimpoperationgrainmerge.h deleted file mode 100644 index b862ffa361..0000000000 --- a/app/operations/layer-modes/gimpoperationgrainmerge.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationgrainmerge.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_GRAIN_MERGE_H__ -#define __GIMP_OPERATION_GRAIN_MERGE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_GRAIN_MERGE (gimp_operation_grain_merge_get_type ()) -#define GIMP_OPERATION_GRAIN_MERGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_GRAIN_MERGE, GimpOperationGrainMerge)) -#define GIMP_OPERATION_GRAIN_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_GRAIN_MERGE, GimpOperationGrainMergeClass)) -#define GIMP_IS_OPERATION_GRAIN_MERGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_GRAIN_MERGE)) -#define GIMP_IS_OPERATION_GRAIN_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_GRAIN_MERGE)) -#define GIMP_OPERATION_GRAIN_MERGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_GRAIN_MERGE, GimpOperationGrainMergeClass)) - - -typedef struct _GimpOperationGrainMerge GimpOperationGrainMerge; -typedef struct _GimpOperationGrainMergeClass GimpOperationGrainMergeClass; - -struct _GimpOperationGrainMerge -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationGrainMergeClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_grain_merge_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_grain_merge_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_GRAIN_MERGE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationhardlight.c b/app/operations/layer-modes/gimpoperationhardlight.c deleted file mode 100644 index bdb8e13a5d..0000000000 --- a/app/operations/layer-modes/gimpoperationhardlight.c +++ /dev/null @@ -1,71 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhardlightmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationhardlight.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationHardlight, gimp_operation_hardlight, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_hardlight_class_init (GimpOperationHardlightClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:hardlight", - "description", "GIMP hardlight mode operation", - NULL); - - point_class->process = gimp_operation_hardlight_process; -} - -static void -gimp_operation_hardlight_init (GimpOperationHardlight *self) -{ -} - -gboolean -gimp_operation_hardlight_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_hardlight); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationhardlight.h b/app/operations/layer-modes/gimpoperationhardlight.h deleted file mode 100644 index 3a39ac3024..0000000000 --- a/app/operations/layer-modes/gimpoperationhardlight.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhardlight.h - * Copyright (C) 2008 Michael Natterer - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_HARDLIGHT_H__ -#define __GIMP_OPERATION_HARDLIGHT_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_HARDLIGHT (gimp_operation_hardlight_get_type ()) -#define GIMP_OPERATION_HARDLIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_HARDLIGHT, GimpOperationHardlight)) -#define GIMP_OPERATION_HARDLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_HARDLIGHT, GimpOperationHardlightClass)) -#define GIMP_IS_OPERATION_HARDLIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_HARDLIGHT)) -#define GIMP_IS_OPERATION_HARDLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_HARDLIGHT)) -#define GIMP_OPERATION_HARDLIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_HARDLIGHT, GimpOperationHardlightClass)) - - -typedef struct _GimpOperationHardlight GimpOperationHardlight; -typedef struct _GimpOperationHardlightClass GimpOperationHardlightClass; - -struct _GimpOperationHardlight -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationHardlightClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_hardlight_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_hardlight_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_HARDLIGHT_H__ */ diff --git a/app/operations/layer-modes/gimpoperationhsvcolor.c b/app/operations/layer-modes/gimpoperationhsvcolor.c deleted file mode 100644 index f59ecc65aa..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvcolor.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationcolormode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include -#include -#include - -#include "libgimpcolor/gimpcolor.h" - -#include "../operations-types.h" - -#include "gimpoperationhsvcolor.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationHsvColor, gimp_operation_hsv_color, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_hsv_color_class_init (GimpOperationHsvColorClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:hsv-color", - "description", "GIMP color mode operation", - NULL); - - point_class->process = gimp_operation_hsv_color_process; -} - -static void -gimp_operation_hsv_color_init (GimpOperationHsvColor *self) -{ -} - -gboolean -gimp_operation_hsv_color_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_hsv_color); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationhsvcolor.h b/app/operations/layer-modes/gimpoperationhsvcolor.h deleted file mode 100644 index 3314e3aafd..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvcolor.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhsvcolor.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_HSV_COLOR_H__ -#define __GIMP_OPERATION_HSV_COLOR_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_HSV_COLOR (gimp_operation_hsv_color_get_type ()) -#define GIMP_OPERATION_HSV_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColor)) -#define GIMP_OPERATION_HSV_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColorClass)) -#define GIMP_IS_OPERATION_HSV_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_COLOR)) -#define GIMP_IS_OPERATION_HSV_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_COLOR)) -#define GIMP_OPERATION_HSV_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColorClass)) - - -typedef struct _GimpOperationHsvColor GimpOperationHsvColor; -typedef struct _GimpOperationHsvColorClass GimpOperationHsvColorClass; - -struct _GimpOperationHsvColor -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationHsvColorClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_hsv_color_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_hsv_color_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_HSV_COLOR_H__ */ diff --git a/app/operations/layer-modes/gimpoperationhsvhue.c b/app/operations/layer-modes/gimpoperationhsvhue.c deleted file mode 100644 index 3a05aa5470..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvhue.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhuemode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include -#include -#include - -#include "libgimpcolor/gimpcolor.h" - -#include "../operations-types.h" - -#include "gimpoperationhsvhue.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationHsvHue, gimp_operation_hsv_hue, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_hsv_hue_class_init (GimpOperationHsvHueClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:hsv-hue", - "description", "GIMP hue mode operation", - NULL); - - point_class->process = gimp_operation_hsv_hue_process; -} - -static void -gimp_operation_hsv_hue_init (GimpOperationHsvHue *self) -{ -} - -gboolean -gimp_operation_hsv_hue_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_hsv_hue); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationhsvhue.h b/app/operations/layer-modes/gimpoperationhsvhue.h deleted file mode 100644 index 8c322803d3..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvhue.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhsvhue.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_HSV_HUE_H__ -#define __GIMP_OPERATION_HSV_HUE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_HSV_HUE (gimp_operation_hsv_hue_get_type ()) -#define GIMP_OPERATION_HUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHue)) -#define GIMP_OPERATION_HUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHueClass)) -#define GIMP_IS_OPERATION_HUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_HSV_HUE_MODE)) -#define GIMP_IS_OPERATION_HUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_HSV_HUE_MODE)) -#define GIMP_OPERATION_HUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHueClass)) - - -typedef struct _GimpOperationHsvHue GimpOperationHsvHue; -typedef struct _GimpOperationHsvHueClass GimpOperationHsvHueClass; - -struct _GimpOperationHsvHue -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationHsvHueClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_hsv_hue_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_hsv_hue_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_HSV_HUE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationhsvsaturation.c b/app/operations/layer-modes/gimpoperationhsvsaturation.c deleted file mode 100644 index ca51f4772d..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvsaturation.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationsaturationmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include -#include -#include - -#include "libgimpcolor/gimpcolor.h" - -#include "../operations-types.h" - -#include "gimpoperationhsvsaturation.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationHsvSaturation, gimp_operation_hsv_saturation, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_hsv_saturation_class_init (GimpOperationHsvSaturationClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:hsv-saturation", - "description", "GIMP saturation mode operation", - NULL); - - point_class->process = gimp_operation_hsv_saturation_process; -} - -static void -gimp_operation_hsv_saturation_init (GimpOperationHsvSaturation *self) -{ -} - -gboolean -gimp_operation_hsv_saturation_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_hsv_saturation); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationhsvsaturation.h b/app/operations/layer-modes/gimpoperationhsvsaturation.h deleted file mode 100644 index 33a7073172..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvsaturation.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhsvsaturation.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_HSV_SATURATION_H__ -#define __GIMP_OPERATION_HSV_SATURATION_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_HSV_SATURATION (gimp_operation_hsv_saturation_get_type ()) -#define GIMP_OPERATION_HSV_SATURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturation)) -#define GIMP_OPERATION_HSV_SATURATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturationClass)) -#define GIMP_IS_OPERATION_HSV_SATURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_HSV_SATURATION)) -#define GIMP_IS_OPERATION_HSV_SATURATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_HSV_SATURATION)) -#define GIMP_OPERATION_HSV_SATURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturationClass)) - - -typedef struct _GimpOperationHsvSaturation GimpOperationHsvSaturation; -typedef struct _GimpOperationHsvSaturationClass GimpOperationHsvSaturationClass; - -struct _GimpOperationHsvSaturation -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationHsvSaturationClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_hsv_saturation_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_hsv_saturation_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_HSV_SATURATION_H__ */ diff --git a/app/operations/layer-modes/gimpoperationhsvvalue.c b/app/operations/layer-modes/gimpoperationhsvvalue.c deleted file mode 100644 index 14a4a8218f..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvvalue.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationvaluemode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include -#include -#include - -#include "libgimpcolor/gimpcolor.h" - -#include "../operations-types.h" - -#include "gimpoperationhsvvalue.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationHsvValue, gimp_operation_hsv_value, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_hsv_value_class_init (GimpOperationHsvValueClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:hsv-value", - "description", "GIMP value mode operation", - NULL); - - point_class->process = gimp_operation_hsv_value_process; -} - -static void -gimp_operation_hsv_value_init (GimpOperationHsvValue *self) -{ -} - -gboolean -gimp_operation_hsv_value_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_hsv_value); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationhsvvalue.h b/app/operations/layer-modes/gimpoperationhsvvalue.h deleted file mode 100644 index 408ab0b13e..0000000000 --- a/app/operations/layer-modes/gimpoperationhsvvalue.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationhsvvalue.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_HSV_VALUE_H__ -#define __GIMP_OPERATION_HSV_VALUE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_HSV_VALUE (gimp_operation_hsv_value_get_type ()) -#define GIMP_OPERATION_HSV_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValue)) -#define GIMP_OPERATION_HSV_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValueClass)) -#define GIMP_IS_OPERATION_HSV_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_VALUE)) -#define GIMP_IS_OPERATION_HSV_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_VALUE)) -#define GIMP_OPERATION_HSV_VALUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValueClass)) - - -typedef struct _GimpOperationHsvValue GimpOperationHsvValue; -typedef struct _GimpOperationHsvValueClass GimpOperationHsvValueClass; - -struct _GimpOperationHsvValue -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationHsvValueClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_hsv_value_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_hsv_value_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_HSV_VALUE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlayermode.c b/app/operations/layer-modes/gimpoperationlayermode.c index e339d1193b..8b44c678aa 100644 --- a/app/operations/layer-modes/gimpoperationlayermode.c +++ b/app/operations/layer-modes/gimpoperationlayermode.c @@ -60,7 +60,6 @@ static gboolean gimp_operation_layer_mode_process (GeglOperation *op const GeglRectangle *result, gint level); - G_DEFINE_TYPE (GimpOperationLayerMode, gimp_operation_layer_mode, GEGL_TYPE_OPERATION_POINT_COMPOSER3) @@ -78,14 +77,23 @@ const Babl *_gimp_fish_laba_to_perceptual = NULL; static void gimp_operation_layer_mode_class_init (GimpOperationLayerModeClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass); + GObjectClass *object_class; + GeglOperationClass *operation_class; + GeglOperationPointComposer3Class *point_composer3_class; + + object_class = G_OBJECT_CLASS (klass); + operation_class = GEGL_OPERATION_CLASS (klass); + point_composer3_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); + + gegl_operation_class_set_keys (operation_class, + "name", "gimp:layer-mode", NULL); object_class->set_property = gimp_operation_layer_mode_set_property; object_class->get_property = gimp_operation_layer_mode_get_property; - operation_class->prepare = gimp_operation_layer_mode_prepare; - operation_class->process = gimp_operation_layer_mode_process; + operation_class->prepare = gimp_operation_layer_mode_prepare; + operation_class->process = gimp_operation_layer_mode_process; + point_composer3_class->process = gimp_operation_layer_mode_process_pixels; g_object_class_install_property (object_class, PROP_LAYER_MODE, g_param_spec_enum ("layer-mode", @@ -276,3 +284,1333 @@ gimp_operation_layer_mode_process (GeglOperation *operation, output_prop, result, level); } + + +static inline GimpBlendFunc gimp_layer_mode_get_blend_fun (GimpLayerMode mode); + +static inline void gimp_composite_blend (gpointer op, + gfloat *in, + gfloat *layer, + gfloat *mask, + gfloat *out, + glong samples, + GimpBlendFunc blend_func); +gboolean +gimp_operation_layer_mode_process_pixels (GeglOperation *operation, + void *in, + void *layer, + void *mask, + void *out, + glong samples, + const GeglRectangle *roi, + gint level) +{ + GimpOperationLayerMode *layer_mode = (GimpOperationLayerMode*)(operation); + gimp_composite_blend (operation, in, layer, mask, out, samples, + gimp_layer_mode_get_blend_fun (layer_mode->layer_mode)); + return TRUE; +} + + +#include +#include + +#include "libgimpcolor/gimpcolor.h" +#include "libgimpmath/gimpmath.h" + + +extern const Babl *_gimp_fish_rgba_to_perceptual; +extern const Babl *_gimp_fish_perceptual_to_rgba; +extern const Babl *_gimp_fish_perceptual_to_laba; +extern const Babl *_gimp_fish_rgba_to_laba; +extern const Babl *_gimp_fish_laba_to_rgba; +extern const Babl *_gimp_fish_laba_to_perceptual; + + +static inline void +compfun_src_atop (gfloat *in, + gfloat *layer, + gfloat *mask, + gfloat opacity, + gfloat *out, + gint samples) +{ + while (samples--) + { + gfloat layer_alpha = layer[ALPHA] * opacity; + + if (mask) + layer_alpha *= *mask; + + if (layer_alpha == 0.0f) + { + out[RED] = in[RED]; + out[GREEN] = in[GREEN]; + out[BLUE] = in[BLUE]; + } + else + { + gint b; + + for (b = RED; b < ALPHA; b++) + out[b] = layer[b] * layer_alpha + in[b] * (1.0f - layer_alpha); + } + + out[ALPHA] = in[ALPHA]; + + in += 4; + out += 4; + layer += 4; + + if (mask) + mask++; + } +} + +static inline void +compfun_src_over (gfloat *in, + gfloat *layer, + gfloat *comp, + gfloat *mask, + gfloat opacity, + gfloat *out, + gint samples) +{ + while (samples--) + { + gfloat new_alpha; + gfloat layer_alpha = layer[ALPHA] * opacity; + + if (mask) + layer_alpha *= *mask; + + new_alpha = layer_alpha + (1.0f - layer_alpha) * in[ALPHA]; + + if (layer_alpha == 0.0f || new_alpha == 0.0f) + { + out[RED] = in[RED]; + out[GREEN] = in[GREEN]; + out[BLUE] = in[BLUE]; + } + else + { + gfloat ratio = layer_alpha / new_alpha; + gint b; + + for (b = RED; b < ALPHA; b++) + out[b] = ratio * (in[ALPHA] * (comp[b] - layer[b]) + layer[b] - in[b]) + in[b]; + } + + out[ALPHA] = new_alpha; + + in += 4; + layer += 4; + comp += 4; + out += 4; + + if (mask) + mask++; + } +} + +static inline void +compfun_dst_atop (gfloat *in, + gfloat *layer, + gfloat *comp, + gfloat *mask, + gfloat opacity, + gfloat *out, + gint samples) +{ + while (samples--) + { + gfloat layer_alpha = layer[ALPHA] * opacity; + + if (mask) + layer_alpha *= *mask; + + if (layer_alpha == 0.0f) + { + out[RED] = in[RED]; + out[GREEN] = in[GREEN]; + out[BLUE] = in[BLUE]; + } + else + { + gint b; + + for (b = RED; b < ALPHA; b++) + out[b] = comp[b] * in[ALPHA] + layer[b] * (1.0f - in[ALPHA]); + } + + out[ALPHA] = layer_alpha; + + in += 4; + layer += 4; + comp += 4; + out += 4; + + if (mask) + mask++; + } +} + +static inline void +compfun_src_in (gfloat *in, + gfloat *layer, + gfloat *mask, + gfloat opacity, + gfloat *out, + gint samples) +{ + while (samples--) + { + gfloat new_alpha = in[ALPHA] * layer[ALPHA] * opacity; + + if (mask) + new_alpha *= *mask; + + if (new_alpha == 0.0f) + { + out[RED] = in[RED]; + out[GREEN] = in[GREEN]; + out[BLUE] = in[BLUE]; + } + else + { + out[RED] = layer[RED]; + out[GREEN] = layer[GREEN]; + out[BLUE] = layer[BLUE]; + } + + out[ALPHA] = new_alpha; + + in += 4; + out += 4; + layer += 4; + + if (mask) + mask++; + } +} + +static inline void +gimp_composite_blend (gpointer op, + gfloat *in, + gfloat *layer, + gfloat *mask, + gfloat *out, + glong samples, + GimpBlendFunc blend_func) +{ + GimpOperationLayerMode *layer_mode = op; + gfloat opacity = layer_mode->opacity; + GimpLayerColorSpace blend_space = layer_mode->blend_space; + GimpLayerColorSpace composite_space= layer_mode->composite_space; + GimpLayerCompositeMode composite_mode = layer_mode->composite_mode; + + gfloat *blend_in = in; + gfloat *blend_layer = layer; + gfloat *blend_out = out; + + gfloat *composite_in = NULL; + gfloat *composite_layer = NULL; + + gboolean composite_needs_in_color = + composite_mode == GIMP_LAYER_COMPOSITE_SRC_OVER || + composite_mode == GIMP_LAYER_COMPOSITE_SRC_ATOP; + gboolean composite_needs_layer_color = + composite_mode == GIMP_LAYER_COMPOSITE_SRC_OVER || + composite_mode == GIMP_LAYER_COMPOSITE_DST_ATOP; + + const Babl *fish_to_blend = NULL; + const Babl *fish_to_composite = NULL; + const Babl *fish_from_composite = NULL; + + switch (blend_space) + { + default: + case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: + fish_to_blend = NULL; + switch (composite_space) + { + case GIMP_LAYER_COLOR_SPACE_LAB: + fish_to_composite = _gimp_fish_rgba_to_laba; + fish_from_composite = _gimp_fish_laba_to_rgba; + break; + default: + case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: + fish_to_composite = NULL; + fish_from_composite = NULL; + break; + case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: + fish_to_composite = _gimp_fish_rgba_to_perceptual; + fish_from_composite = _gimp_fish_perceptual_to_rgba; + break; + } + break; + + case GIMP_LAYER_COLOR_SPACE_LAB: + fish_to_blend = _gimp_fish_rgba_to_laba; + switch (composite_space) + { + case GIMP_LAYER_COLOR_SPACE_LAB: + default: + fish_to_composite = NULL; + fish_from_composite = _gimp_fish_laba_to_rgba; + break; + case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: + fish_to_composite = _gimp_fish_laba_to_rgba; + fish_from_composite = NULL; + break; + case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: + fish_to_composite = _gimp_fish_laba_to_perceptual; + fish_from_composite = _gimp_fish_perceptual_to_rgba; + break; + } + break; + + case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: + fish_to_blend = _gimp_fish_rgba_to_perceptual; + switch (composite_space) + { + case GIMP_LAYER_COLOR_SPACE_LAB: + default: + fish_to_composite = _gimp_fish_perceptual_to_laba; + fish_from_composite = NULL; + break; + case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: + fish_to_composite = _gimp_fish_perceptual_to_rgba; + fish_from_composite = NULL; + break; + case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: + fish_to_composite = NULL; + fish_from_composite = _gimp_fish_perceptual_to_rgba; + break; + } + break; + } + + if (in == out) /* in-place detected, avoid clobbering since we need to + read it for the compositing stage */ + blend_out = g_alloca (sizeof (gfloat) * 4 * samples); + + if (fish_to_blend) + { + if (in != out || (composite_needs_in_color && + composite_space == GIMP_LAYER_COLOR_SPACE_RGB_LINEAR)) + { + /* don't convert input in-place if we're not doing in-place output, + * or if we're going to need the original input for compositing. + */ + blend_in = g_alloca (sizeof (gfloat) * 4 * samples); + } + blend_layer = g_alloca (sizeof (gfloat) * 4 * samples); + + babl_process (fish_to_blend, in, blend_in, samples); + babl_process (fish_to_blend, layer, blend_layer, samples); + } + + blend_func (blend_in, blend_layer, blend_out, samples); + + composite_in = blend_in; + composite_layer = blend_layer; + + if (fish_to_composite) + { + if (composite_space == GIMP_LAYER_COLOR_SPACE_RGB_LINEAR) + { + composite_in = in; + composite_layer = layer; + } + else + { + if (composite_needs_in_color) + { + if (composite_in == in && in != out) + composite_in = g_alloca (sizeof (gfloat) * 4 * samples); + + babl_process (fish_to_composite, + blend_in, composite_in, samples); + } + + if (composite_needs_layer_color) + { + if (composite_layer == layer) + composite_layer = g_alloca (sizeof (gfloat) * 4 * samples); + + babl_process (fish_to_composite, + blend_layer, composite_layer, samples); + } + } + + babl_process (fish_to_composite, blend_out, blend_out, samples); + } + + switch (composite_mode) + { + case GIMP_LAYER_COMPOSITE_SRC_ATOP: + default: + compfun_src_atop (composite_in, blend_out, mask, opacity, out, samples); + break; + + case GIMP_LAYER_COMPOSITE_SRC_OVER: + compfun_src_over (composite_in, composite_layer, blend_out, mask, opacity, out, samples); + break; + + case GIMP_LAYER_COMPOSITE_DST_ATOP: + compfun_dst_atop (composite_in, composite_layer, blend_out, mask, opacity, out, samples); + break; + + case GIMP_LAYER_COMPOSITE_SRC_IN: + compfun_src_in (composite_in, blend_out, mask, opacity, out, samples); + break; + } + + if (fish_from_composite) + { + babl_process (fish_from_composite, out, out, samples); + } +} + +static inline void +blendfun_screen (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = 1.0f - (1.0f - dest[c]) * (1.0f - src[c]); + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void /* aka linear_dodge */ +blendfun_addition (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] + src[c]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + + +static inline void +blendfun_linear_burn (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] + src[c] - 1.0f; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_subtract (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] - src[c]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_multiply (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] * src[c]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_normal (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = src[c]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_burn (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp = 1.0f - (1.0f - dest[c]) / src[c]; + + /* The CLAMP macro is deliberately inlined and written + * to map comp == NAN (0 / 0) -> 1 + */ + out[c] = comp < 0 ? 0.0f : comp < 1.0f ? comp : 1.0f; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_darken_only (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = MIN (dest[c], src[c]); + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_lighten_only (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = MAX (dest[c], src[c]); + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_difference (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + out[c] = dest[c] - src[c]; + + if (out[c] < 0) + out[c] = -out[c]; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_divide (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp = dest[c] / src[c]; + + /* make infinities(or NaN) correspond to a high number, + * to get more predictable math, ideally higher than 5.0 + * but it seems like some babl conversions might be + * acting up then + */ + if (!(comp > -42949672.0f && comp < 5.0f)) + comp = 5.0f; + + out[c] = comp; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_dodge (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp = dest[c] / (1.0f - src[c]); + + comp = MIN (comp, 1.0f); + + out[c] = comp; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_grain_extract (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] - src[c] + 0.5f; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_grain_merge (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + out[c] = dest[c] + src[c] - 0.5f; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_hardlight (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp; + + if (src[c] > 0.5f) + { + comp = (1.0f - dest[c]) * (1.0f - (src[c] - 0.5f) * 2.0f); + comp = MIN (1 - comp, 1); + } + else + { + comp = dest[c] * (src[c] * 2.0f); + comp = MIN (comp, 1.0f); + } + + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_softlight (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat multiply = dest[c] * src[c]; + gfloat screen = 1.0f - (1.0f - dest[c]) * (1.0f - src[c]); + gfloat comp = (1.0f - dest[c]) * multiply + dest[c] * screen; + + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_overlay (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp; + + if (dest[c] < 0.5f) + { + comp = 2.0f * dest[c] * src[c]; + } + else + { + comp = 1.0f - 2.0f * (1.0f - src[c]) * (1.0f - dest[c]); + } + + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_hsv_color (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; + GimpRGB src_rgb = { src[0], src[1], src[2] }; + GimpHSL src_hsl, dest_hsl; + + gimp_rgb_to_hsl (&dest_rgb, &dest_hsl); + gimp_rgb_to_hsl (&src_rgb, &src_hsl); + + dest_hsl.h = src_hsl.h; + dest_hsl.s = src_hsl.s; + + gimp_hsl_to_rgb (&dest_hsl, &dest_rgb); + + out[RED] = dest_rgb.r; + out[GREEN] = dest_rgb.g; + out[BLUE] = dest_rgb.b; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_hsv_hue (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; + GimpRGB src_rgb = { src[0], src[1], src[2] }; + GimpHSV src_hsv, dest_hsv; + + gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); + gimp_rgb_to_hsv (&src_rgb, &src_hsv); + + dest_hsv.h = src_hsv.h; + gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); + + out[RED] = dest_rgb.r; + out[GREEN] = dest_rgb.g; + out[BLUE] = dest_rgb.b; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_hsv_saturation (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; + GimpRGB src_rgb = { src[0], src[1], src[2] }; + GimpHSV src_hsv, dest_hsv; + + gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); + gimp_rgb_to_hsv (&src_rgb, &src_hsv); + + dest_hsv.s = src_hsv.s; + gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); + + out[RED] = dest_rgb.r; + out[GREEN] = dest_rgb.g; + out[BLUE] = dest_rgb.b; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_hsv_value (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + GimpRGB dest_rgb = { dest[0], dest[1], dest[2] }; + GimpRGB src_rgb = { src[0], src[1], src[2] }; + GimpHSV src_hsv, dest_hsv; + + gimp_rgb_to_hsv (&dest_rgb, &dest_hsv); + gimp_rgb_to_hsv (&src_rgb, &src_hsv); + + dest_hsv.v = src_hsv.v; + gimp_hsv_to_rgb (&dest_hsv, &dest_rgb); + + out[RED] = dest_rgb.r; + out[GREEN] = dest_rgb.g; + out[BLUE] = dest_rgb.b; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_lch_chroma (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gfloat A1 = dest[1]; + gfloat B1 = dest[2]; + gfloat c1 = hypotf (A1, B1); + + if (c1 != 0.0f) + { + gfloat A2 = src[1]; + gfloat B2 = src[2]; + gfloat c2 = hypotf (A2, B2); + gfloat A = c2 * A1 / c1; + gfloat B = c2 * B1 / c1; + + out[0] = dest[0]; + out[1] = A; + out[2] = B; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_lch_color (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + out[0] = dest[0]; + out[1] = src[1]; + out[2] = src[2]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_lch_hue (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gfloat A2 = src[1]; + gfloat B2 = src[2]; + gfloat c2 = hypotf (A2, B2); + + if (c2 > 0.1f) + { + gfloat A1 = dest[1]; + gfloat B1 = dest[2]; + gfloat c1 = hypotf (A1, B1); + gfloat A = c1 * A2 / c2; + gfloat B = c1 * B2 / c2; + + out[0] = dest[0]; + out[1] = A; + out[2] = B; + } + else + { + out[0] = dest[0]; + out[1] = dest[1]; + out[2] = dest[2]; + } + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_lch_lightness (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + out[0] = src[0]; + out[1] = dest[1]; + out[2] = dest[2]; + } + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + + +static inline void +blendfun_copy (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + gint c; + for (c = 0; c < 4; c++) + out[c] = src[c]; + + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +/* added according to: + http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ +static inline void +blendfun_vivid_light (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp; + + if (src[c] > 0.5f) + { + comp = (1.0f - (1.0f - dest[c]) / (2.0f * (src[c]))); + } + else + { + comp = dest[c] / (1.0f - 2.0f * (src[c] - 0.5)); + } + comp = MIN (comp, 1.0f); + + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + + +/* added according to: + http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ +static inline void +blendfun_linear_light (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp; + if (src[c] > 0.5f) + { + comp = dest[c] + 2.0 * (src[c] - 0.5); + } + else + { + comp = dest[c] + 2.0 * src[c] - 1.0; + } + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + + +/* added according to: + http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html */ +static inline void +blendfun_pin_light (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + gfloat comp; + if (src[c] > 0.5f) + { + comp = MAX(dest[c], 2 * (src[c] - 0.5)); + } + else + { + comp = MIN(dest[c], 2 * src[c]); + } + out[c] = comp; + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void +blendfun_exclusion (const float *dest, + const float *src, + float *out, + int samples) +{ + while (samples--) + { + if (src[ALPHA] != 0.0f) + { + gint c; + + for (c = 0; c < 3; c++) + { + out[c] = 0.5f - 2.0f * (dest[c] - 0.5f) * (src[c] - 0.5f); + } + } + out[ALPHA] = src[ALPHA]; + + out += 4; + src += 4; + dest += 4; + } +} + +static inline void dummy_fun(void) +{ +} + +static inline GimpBlendFunc gimp_layer_mode_get_blend_fun (GimpLayerMode mode) +{ + switch (mode) + { + case GIMP_LAYER_MODE_SCREEN_LINEAR: + case GIMP_LAYER_MODE_SCREEN: return blendfun_screen; + case GIMP_LAYER_MODE_ADDITION_LINEAR: + case GIMP_LAYER_MODE_ADDITION: return blendfun_addition; + case GIMP_LAYER_MODE_SUBTRACT_LINEAR: + case GIMP_LAYER_MODE_SUBTRACT: return blendfun_subtract; + case GIMP_LAYER_MODE_MULTIPLY_LINEAR: + case GIMP_LAYER_MODE_MULTIPLY: return blendfun_multiply; + case GIMP_LAYER_MODE_NORMAL: return blendfun_normal; + case GIMP_LAYER_MODE_BURN_LINEAR: + case GIMP_LAYER_MODE_BURN: return blendfun_burn; + case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR: + case GIMP_LAYER_MODE_GRAIN_MERGE: return blendfun_grain_merge; + case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR: + case GIMP_LAYER_MODE_GRAIN_EXTRACT: return blendfun_grain_merge; + case GIMP_LAYER_MODE_DODGE_LINEAR: + case GIMP_LAYER_MODE_DODGE: return blendfun_dodge; + case GIMP_LAYER_MODE_OVERLAY_LINEAR: + case GIMP_LAYER_MODE_OVERLAY: return blendfun_overlay; + case GIMP_LAYER_MODE_HSV_COLOR: return blendfun_hsv_color; + case GIMP_LAYER_MODE_HSV_HUE: return blendfun_hsv_hue; + case GIMP_LAYER_MODE_HSV_SATURATION: return blendfun_hsv_saturation; + case GIMP_LAYER_MODE_HSV_VALUE: return blendfun_hsv_value; + case GIMP_LAYER_MODE_LCH_CHROMA: return blendfun_lch_chroma; + case GIMP_LAYER_MODE_LCH_COLOR: return blendfun_lch_color; + case GIMP_LAYER_MODE_LCH_HUE: return blendfun_lch_hue; + case GIMP_LAYER_MODE_LCH_LIGHTNESS: return blendfun_lch_lightness; + case GIMP_LAYER_MODE_HARDLIGHT_LINEAR: + case GIMP_LAYER_MODE_HARDLIGHT: return blendfun_hardlight; + case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR: + case GIMP_LAYER_MODE_SOFTLIGHT: return blendfun_softlight; + case GIMP_LAYER_MODE_DIVIDE: + case GIMP_LAYER_MODE_DIVIDE_LINEAR: return blendfun_divide; + case GIMP_LAYER_MODE_DIFFERENCE_LINEAR: + case GIMP_LAYER_MODE_DIFFERENCE: return blendfun_difference; + case GIMP_LAYER_MODE_DARKEN_ONLY: return blendfun_darken_only; + case GIMP_LAYER_MODE_LIGHTEN_ONLY: return blendfun_lighten_only; + case GIMP_LAYER_MODE_VIVID_LIGHT: return blendfun_vivid_light; + case GIMP_LAYER_MODE_PIN_LIGHT: return blendfun_pin_light; + case GIMP_LAYER_MODE_LINEAR_LIGHT: return blendfun_linear_light; + case GIMP_LAYER_MODE_EXCLUSION: return blendfun_exclusion; + case GIMP_LAYER_MODE_LINEAR_BURN: return blendfun_linear_burn; + default: + return (void*)dummy_fun; + } +} diff --git a/app/operations/layer-modes/gimpoperationlayermode.h b/app/operations/layer-modes/gimpoperationlayermode.h index c95790bf85..545203fbfc 100644 --- a/app/operations/layer-modes/gimpoperationlayermode.h +++ b/app/operations/layer-modes/gimpoperationlayermode.h @@ -56,5 +56,14 @@ struct _GimpOperationLayerMode GType gimp_operation_layer_mode_get_type (void) G_GNUC_CONST; +gboolean +gimp_operation_layer_mode_process_pixels (GeglOperation *operation, + void *in, + void *layer, + void *mask, + void *out, + glong samples, + const GeglRectangle *roi, + gint level); #endif /* __GIMP_OPERATION_LAYER_MODE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlchchroma.c b/app/operations/layer-modes/gimpoperationlchchroma.c deleted file mode 100644 index 6a9cccd920..0000000000 --- a/app/operations/layer-modes/gimpoperationlchchroma.c +++ /dev/null @@ -1,75 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchchroma.c - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationlchchroma.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationLchChroma, gimp_operation_lch_chroma, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_lch_chroma_class_init (GimpOperationLchChromaClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - operation_class->want_in_place = FALSE; - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:lch-chroma", - "description", "GIMP LCH chroma mode operation", - NULL); - - point_class->process = gimp_operation_lch_chroma_process; -} - -static void -gimp_operation_lch_chroma_init (GimpOperationLchChroma *self) -{ -} - -gboolean -gimp_operation_lch_chroma_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_lch_chroma); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationlchchroma.h b/app/operations/layer-modes/gimpoperationlchchroma.h deleted file mode 100644 index 52d850d805..0000000000 --- a/app/operations/layer-modes/gimpoperationlchchroma.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchchroma.h - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_LCH_CHROMA_H__ -#define __GIMP_OPERATION_LCH_CHROMA_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_LCH_CHROMA (gimp_operation_lch_chroma_get_type ()) -#define GIMP_OPERATION_LCH_CHROMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LCH_CHROMA, GimpOperationLchChroma)) -#define GIMP_OPERATION_LCH_CHROMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LCH_CHROMA, GimpOperationLchChromaClass)) -#define GIMP_IS_OPERATION_LCH_CHROMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LCH_CHROMA)) -#define GIMP_IS_OPERATION_LCH_CHROMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LCH_CHROMA)) -#define GIMP_OPERATION_LCH_CHROMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LCH_CHROMA, GimpOperationLchChromaClass)) - - -typedef struct _GimpOperationLchChroma GimpOperationLchChroma; -typedef struct _GimpOperationLchChromaClass GimpOperationLchChromaClass; - -struct _GimpOperationLchChroma -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationLchChromaClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_lch_chroma_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_lch_chroma_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_LCH_CHROMA_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlchcolor.c b/app/operations/layer-modes/gimpoperationlchcolor.c deleted file mode 100644 index d64cd6d0ac..0000000000 --- a/app/operations/layer-modes/gimpoperationlchcolor.c +++ /dev/null @@ -1,75 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchcolor.c - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationlchcolor.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationLchColor, gimp_operation_lch_color, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_lch_color_class_init (GimpOperationLchColorClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - operation_class->want_in_place = FALSE; - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:lch-color", - "description", "GIMP LCH color mode operation", - NULL); - - point_class->process = gimp_operation_lch_color_process; -} - -static void -gimp_operation_lch_color_init (GimpOperationLchColor *self) -{ -} - -gboolean -gimp_operation_lch_color_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_lch_color); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationlchcolor.h b/app/operations/layer-modes/gimpoperationlchcolor.h deleted file mode 100644 index ca0007d65a..0000000000 --- a/app/operations/layer-modes/gimpoperationlchcolor.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchcolor.h - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_LCH_COLOR_H__ -#define __GIMP_OPERATION_LCH_COLOR_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_LCH_COLOR (gimp_operation_lch_color_get_type ()) -#define GIMP_OPERATION_LCH_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LCH_COLOR, GimpOperationLchColor)) -#define GIMP_OPERATION_LCH_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LCH_COLOR, GimpOperationLchColorClass)) -#define GIMP_IS_OPERATION_LCH_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LCH_COLOR)) -#define GIMP_IS_OPERATION_LCH_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LCH_COLOR)) -#define GIMP_OPERATION_LCH_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LCH_COLOR, GimpOperationLchColorClass)) - - -typedef struct _GimpOperationLchColor GimpOperationLchColor; -typedef struct _GimpOperationLchColorClass GimpOperationLchColorClass; - -struct _GimpOperationLchColor -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationLchColorClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_lch_color_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_lch_color_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_LCH_COLOR_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlchhue.c b/app/operations/layer-modes/gimpoperationlchhue.c deleted file mode 100644 index 0545554c8d..0000000000 --- a/app/operations/layer-modes/gimpoperationlchhue.c +++ /dev/null @@ -1,75 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchhue.c - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationlchhue.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationLchHue, gimp_operation_lch_hue, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_lch_hue_class_init (GimpOperationLchHueClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - operation_class->want_in_place = FALSE; - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:lch-hue", - "description", "GIMP LCH hue mode operation", - NULL); - - point_class->process = gimp_operation_lch_hue_process; -} - -static void -gimp_operation_lch_hue_init (GimpOperationLchHue *self) -{ -} - -gboolean -gimp_operation_lch_hue_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_lch_hue); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationlchhue.h b/app/operations/layer-modes/gimpoperationlchhue.h deleted file mode 100644 index c692a892e3..0000000000 --- a/app/operations/layer-modes/gimpoperationlchhue.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchhue.h - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_LCH_HUE_H__ -#define __GIMP_OPERATION_LCH_HUE_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_LCH_HUE (gimp_operation_lch_hue_get_type ()) -#define GIMP_OPERATION_LCH_HUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LCH_HUE, GimpOperationLchHue)) -#define GIMP_OPERATION_LCH_HUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LCH_HUE, GimpOperationLchHueClass)) -#define GIMP_IS_OPERATION_LCH_HUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LCH_HUE)) -#define GIMP_IS_OPERATION_LCH_HUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LCH_HUE)) -#define GIMP_OPERATION_LCH_HUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LCH_HUE, GimpOperationLchHueClass)) - - -typedef struct _GimpOperationLchHue GimpOperationLchHue; -typedef struct _GimpOperationLchHueClass GimpOperationLchHueClass; - -struct _GimpOperationLchHue -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationLchHueClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_lch_hue_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_lch_hue_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_LCH_HUE_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlchlightness.c b/app/operations/layer-modes/gimpoperationlchlightness.c deleted file mode 100644 index ee83a0f340..0000000000 --- a/app/operations/layer-modes/gimpoperationlchlightness.c +++ /dev/null @@ -1,75 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchlightness.c - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationlchlightness.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationLchLightness, gimp_operation_lch_lightness, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_lch_lightness_class_init (GimpOperationLchLightnessClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - operation_class->want_in_place = FALSE; - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:lch-lightness", - "description", "GIMP LCH lightness mode operation", - NULL); - - point_class->process = gimp_operation_lch_lightness_process; -} - -static void -gimp_operation_lch_lightness_init (GimpOperationLchLightness *self) -{ -} - -gboolean -gimp_operation_lch_lightness_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_lch_lightness); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationlchlightness.h b/app/operations/layer-modes/gimpoperationlchlightness.h deleted file mode 100644 index e862b4bd56..0000000000 --- a/app/operations/layer-modes/gimpoperationlchlightness.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlchlightness.h - * Copyright (C) 2015 Elle Stone - * Massimo Valentini - * Thomas Manni - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_LCH_LIGHTNESS_H__ -#define __GIMP_OPERATION_LCH_LIGHTNESS_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_LCH_LIGHTNESS (gimp_operation_lch_lightness_get_type ()) -#define GIMP_OPERATION_LCH_LIGHTNESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LCH_LIGHTNESS, GimpOperationLchLightness)) -#define GIMP_OPERATION_LCH_LIGHTNESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LCH_LIGHTNESS, GimpOperationLchLightnessClass)) -#define GIMP_IS_OPERATION_LCH_LIGHTNESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LCH_LIGHTNESS)) -#define GIMP_IS_OPERATION_LCH_LIGHTNESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LCH_LIGHTNESS)) -#define GIMP_OPERATION_LCH_LIGHTNESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LCH_LIGHTNESS, GimpOperationLchLightnessClass)) - - -typedef struct _GimpOperationLchLightness GimpOperationLchLightness; -typedef struct _GimpOperationLchLightnessClass GimpOperationLchLightnessClass; - -struct _GimpOperationLchLightness -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationLchLightnessClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_lch_lightness_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_lch_lightness_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_LCH_LIGHTNESS_H__ */ diff --git a/app/operations/layer-modes/gimpoperationlightenonly.c b/app/operations/layer-modes/gimpoperationlightenonly.c deleted file mode 100644 index bc4dfa03fa..0000000000 --- a/app/operations/layer-modes/gimpoperationlightenonly.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlightenonlymode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationlightenonly.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationLightenOnly, gimp_operation_lighten_only, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_lighten_only_class_init (GimpOperationLightenOnlyClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:lighten-only", - "description", "GIMP lighten only mode operation", - NULL); - - point_class->process = gimp_operation_lighten_only_process; -} - -static void -gimp_operation_lighten_only_init (GimpOperationLightenOnly *self) -{ -} - -gboolean -gimp_operation_lighten_only_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_lighten_only); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationlightenonly.h b/app/operations/layer-modes/gimpoperationlightenonly.h deleted file mode 100644 index fe8c785eeb..0000000000 --- a/app/operations/layer-modes/gimpoperationlightenonly.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationlightenonly.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_LIGHTEN_ONLY_H__ -#define __GIMP_OPERATION_LIGHTEN_ONLY_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_LIGHTEN_ONLY (gimp_operation_lighten_only_get_type ()) -#define GIMP_OPERATION_LIGHTEN_ONLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnly)) -#define GIMP_OPERATION_LIGHTEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnlyClass)) -#define GIMP_IS_OPERATION_LIGHTEN_ONLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY)) -#define GIMP_IS_OPERATION_LIGHTEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_LIGHTEN_ONLY)) -#define GIMP_OPERATION_LIGHTEN_ONLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnlyClass)) - - -typedef struct _GimpOperationLightenOnly GimpOperationLightenOnly; -typedef struct _GimpOperationLightenOnlyClass GimpOperationLightenOnlyClass; - -struct _GimpOperationLightenOnly -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationLightenOnlyClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_lighten_only_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_lighten_only_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_LIGHTEN_ONLY_H__ */ diff --git a/app/operations/layer-modes/gimpoperationmultiply.c b/app/operations/layer-modes/gimpoperationmultiply.c deleted file mode 100644 index 383d4777cf..0000000000 --- a/app/operations/layer-modes/gimpoperationmultiply.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationmultiply.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationmultiply.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationMultiply, gimp_operation_multiply, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_multiply_class_init (GimpOperationMultiplyClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:multiply", - "description", "GIMP multiply mode operation", - NULL); - - point_class->process = gimp_operation_multiply_process; -} - -static void -gimp_operation_multiply_init (GimpOperationMultiply *self) -{ -} - -gboolean -gimp_operation_multiply_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_multiply); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationmultiply.h b/app/operations/layer-modes/gimpoperationmultiply.h deleted file mode 100644 index 5e83669778..0000000000 --- a/app/operations/layer-modes/gimpoperationmultiply.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationmultiply.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_MULTIPLY_H__ -#define __GIMP_OPERATION_MULTIPLY_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_MULTIPLY (gimp_operation_multiply_get_type ()) -#define GIMP_OPERATION_MULTIPLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_MULTIPLY, GimpOperationMultiply)) -#define GIMP_OPERATION_MULTIPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_MULTIPLY, GimpOperationMultiplyClass)) -#define GIMP_IS_OPERATION_MULTIPLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_MULTIPLY)) -#define GIMP_IS_OPERATION_MULTIPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_MULTIPLY)) -#define GIMP_OPERATION_MULTIPLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_MULTIPLY, GimpOperationMultiplyClass)) - - -typedef struct _GimpOperationMultiply GimpOperationMultiply; -typedef struct _GimpOperationMultiplyClass GimpOperationMultiplyClass; - -struct _GimpOperationMultiply -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationMultiplyClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_multiply_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_multiply_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_MULTIPLY_H__ */ diff --git a/app/operations/layer-modes/gimpoperationoverlay.c b/app/operations/layer-modes/gimpoperationoverlay.c deleted file mode 100644 index c8de8492cd..0000000000 --- a/app/operations/layer-modes/gimpoperationoverlay.c +++ /dev/null @@ -1,71 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationoverlay.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationoverlay.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationOverlay, gimp_operation_overlay, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_overlay_class_init (GimpOperationOverlayClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:overlay", - "description", "GIMP overlay mode operation", - NULL); - - point_class->process = gimp_operation_overlay_process; -} - -static void -gimp_operation_overlay_init (GimpOperationOverlay *self) -{ -} - -gboolean -gimp_operation_overlay_process (GeglOperation *operation, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (operation, in, layer, mask, out, samples, - blendfun_overlay); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationoverlay.h b/app/operations/layer-modes/gimpoperationoverlay.h deleted file mode 100644 index 23f4824001..0000000000 --- a/app/operations/layer-modes/gimpoperationoverlay.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationoverlay.h - * Copyright (C) 2008 Michael Natterer - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_OVERLAY_H__ -#define __GIMP_OPERATION_OVERLAY_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_OVERLAY (gimp_operation_overlay_get_type ()) -#define GIMP_OPERATION_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlay)) -#define GIMP_OPERATION_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlayClass)) -#define GIMP_IS_OPERATION_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_OVERLAY)) -#define GIMP_IS_OPERATION_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_OVERLAY)) -#define GIMP_OPERATION_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_OVERLAY, GimpOperationOverlayClass)) - - -typedef struct _GimpOperationOverlay GimpOperationOverlay; -typedef struct _GimpOperationOverlayClass GimpOperationOverlayClass; - -struct _GimpOperationOverlay -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationOverlayClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_overlay_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_overlay_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_OVERLAY_H__ */ diff --git a/app/operations/layer-modes/gimpoperationscreen.c b/app/operations/layer-modes/gimpoperationscreen.c deleted file mode 100644 index ed7f786b23..0000000000 --- a/app/operations/layer-modes/gimpoperationscreen.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationscreen.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationscreen.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationScreen, gimp_operation_screen, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_screen_class_init (GimpOperationScreenClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:screen", - "description", "GIMP screen mode operation", - NULL); - - point_class->process = gimp_operation_screen_process; -} - -static void -gimp_operation_screen_init (GimpOperationScreen *self) -{ -} - -gboolean -gimp_operation_screen_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_screen); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationscreen.h b/app/operations/layer-modes/gimpoperationscreen.h deleted file mode 100644 index af8cd9943e..0000000000 --- a/app/operations/layer-modes/gimpoperationscreen.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationscreen.h - * Copyright (C) 2008 Michael Natterer - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_SCREEN_H__ -#define __GIMP_OPERATION_SCREEN_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_SCREEN (gimp_operation_screen_get_type ()) -#define GIMP_OPERATION_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_SCREEN, GimpOperationScreen)) -#define GIMP_OPERATION_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_SCREEN, GimpOperationScreenClass)) -#define GIMP_IS_OPERATION_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_SCREEN)) -#define GIMP_IS_OPERATION_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_SCREEN)) -#define GIMP_OPERATION_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_SCREEN, GimpOperationScreenClass)) - - -typedef struct _GimpOperationScreen GimpOperationScreen; -typedef struct _GimpOperationScreenClass GimpOperationScreenClass; - -struct _GimpOperationScreen -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationScreenClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_screen_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_screen_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_SCREEN_H__ */ diff --git a/app/operations/layer-modes/gimpoperationsoftlight.c b/app/operations/layer-modes/gimpoperationsoftlight.c deleted file mode 100644 index 9676ce54e4..0000000000 --- a/app/operations/layer-modes/gimpoperationsoftlight.c +++ /dev/null @@ -1,90 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationsoftlightmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationsoftlight.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationSoftlight, gimp_operation_softlight, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static const gchar* reference_xml = "" -"" -"" -" " -" " -" B.png" -" " -" " -"" -"" -" " -" A.png" -" " -"" -""; - - -static void -gimp_operation_softlight_class_init (GimpOperationSoftlightClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:softlight", - "description", "GIMP softlight mode operation", - "reference-image", "soft-light-mode.png", - "reference-composition", reference_xml, - NULL); - - point_class->process = gimp_operation_softlight_process; -} - -static void -gimp_operation_softlight_init (GimpOperationSoftlight *self) -{ -} - -gboolean -gimp_operation_softlight_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_softlight); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationsoftlight.h b/app/operations/layer-modes/gimpoperationsoftlight.h deleted file mode 100644 index 46fb35b088..0000000000 --- a/app/operations/layer-modes/gimpoperationsoftlight.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationsoftlight.h - * Copyright (C) 2008 Michael Natterer - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_SOFTLIGHT_H__ -#define __GIMP_OPERATION_SOFTLIGHT_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_SOFTLIGHT (gimp_operation_softlight_get_type ()) -#define GIMP_OPERATION_SOFTLIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_SOFTLIGHT_MODE, GimpOperationSoftlight)) -#define GIMP_OPERATION_SOFTLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_SOFTLIGHT_MODE, GimpOperationSoftlightClass)) -#define GIMP_IS_OPERATION_SOFTLIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_SOFTLIGHT_MODE)) -#define GIMP_IS_OPERATION_SOFTLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_SOFTLIGHT_MODE)) -#define GIMP_OPERATION_SOFTLIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_SOFTLIGHT_MODE, GimpOperationSoftlightClass)) - - -typedef struct _GimpOperationSoftlight GimpOperationSoftlight; -typedef struct _GimpOperationSoftlightClass GimpOperationSoftlightClass; - -struct _GimpOperationSoftlight -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationSoftlightClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_softlight_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_softlight_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_SOFTLIGHT_H__ */ diff --git a/app/operations/layer-modes/gimpoperationsubtract.c b/app/operations/layer-modes/gimpoperationsubtract.c deleted file mode 100644 index 6e0d250625..0000000000 --- a/app/operations/layer-modes/gimpoperationsubtract.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationsubtractmode.c - * Copyright (C) 2008 Michael Natterer - * 2012 Ville Sokk - * 2017 Øyvind Kolås - * - * 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 . - */ - -#include "config.h" - -#include - -#include "../operations-types.h" - -#include "gimpoperationsubtract.h" -#include "gimpblendcomposite.h" - - -G_DEFINE_TYPE (GimpOperationSubtract, gimp_operation_subtract, - GIMP_TYPE_OPERATION_LAYER_MODE) - - -static void -gimp_operation_subtract_class_init (GimpOperationSubtractClass *klass) -{ - GeglOperationClass *operation_class; - GeglOperationPointComposer3Class *point_class; - - operation_class = GEGL_OPERATION_CLASS (klass); - point_class = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass); - - gegl_operation_class_set_keys (operation_class, - "name", "gimp:subtract", - "description", "GIMP subtract mode operation", - NULL); - - point_class->process = gimp_operation_subtract_process; -} - -static void -gimp_operation_subtract_init (GimpOperationSubtract *self) -{ -} - -gboolean -gimp_operation_subtract_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level) -{ - gimp_composite_blend (op, in, layer, mask, out, samples, - blendfun_subtract); - return TRUE; -} diff --git a/app/operations/layer-modes/gimpoperationsubtract.h b/app/operations/layer-modes/gimpoperationsubtract.h deleted file mode 100644 index 306550b256..0000000000 --- a/app/operations/layer-modes/gimpoperationsubtract.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpoperationsubtract.h - * Copyright (C) 2008 Michael Natterer - * 2017 Øyvind Kolås - * - * 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 . - */ - -#ifndef __GIMP_OPERATION_SUBTRACT_H__ -#define __GIMP_OPERATION_SUBTRACT_H__ - - -#include "gimpoperationlayermode.h" - - -#define GIMP_TYPE_OPERATION_SUBTRACT (gimp_operation_subtract_get_type ()) -#define GIMP_OPERATION_SUBTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_SUBTRACT, GimpOperationSubtract)) -#define GIMP_OPERATION_SUBTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_SUBTRACT, GimpOperationSubtractClass)) -#define GIMP_IS_OPERATION_SUBTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_SUBTRACT)) -#define GIMP_IS_OPERATION_SUBTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_SUBTRACT)) -#define GIMP_OPERATION_SUBTRACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_SUBTRACT, GimpOperationSubtractClass)) - - -typedef struct _GimpOperationSubtract GimpOperationSubtract; -typedef struct _GimpOperationSubtractClass GimpOperationSubtractClass; - -struct _GimpOperationSubtract -{ - GimpOperationLayerMode parent_instance; -}; - -struct _GimpOperationSubtractClass -{ - GimpOperationLayerModeClass parent_class; -}; - - -GType gimp_operation_subtract_get_type (void) G_GNUC_CONST; - -gboolean gimp_operation_subtract_process (GeglOperation *op, - void *in, - void *layer, - void *mask, - void *out, - glong samples, - const GeglRectangle *roi, - gint level); - - -#endif /* __GIMP_OPERATION_SUBTRACT_H__ */ diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c index 4c8a875f7c..80e4fa3ece 100644 --- a/app/widgets/gimpwidgets-constructors.c +++ b/app/widgets/gimpwidgets-constructors.c @@ -123,15 +123,20 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode, GIMP_LAYER_MODE_MULTIPLY_LEGACY, GIMP_LAYER_MODE_BURN, GIMP_LAYER_MODE_BURN_LEGACY, + GIMP_LAYER_MODE_LINEAR_BURN, GIMP_LAYER_MODE_OVERLAY, GIMP_LAYER_MODE_SOFTLIGHT, GIMP_LAYER_MODE_SOFTLIGHT_LEGACY, GIMP_LAYER_MODE_HARDLIGHT, GIMP_LAYER_MODE_HARDLIGHT_LEGACY, + GIMP_LAYER_MODE_VIVID_LIGHT, + GIMP_LAYER_MODE_PIN_LIGHT, + GIMP_LAYER_MODE_LINEAR_LIGHT, GIMP_LAYER_MODE_DIFFERENCE, GIMP_LAYER_MODE_DIFFERENCE_LEGACY, GIMP_LAYER_MODE_SUBTRACT, GIMP_LAYER_MODE_SUBTRACT_LEGACY, + GIMP_LAYER_MODE_EXCLUSION, GIMP_LAYER_MODE_GRAIN_EXTRACT, GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY, GIMP_LAYER_MODE_GRAIN_MERGE, @@ -158,10 +163,10 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode, GIMP_LAYER_MODE_ADDITION_LEGACY, -1); gimp_int_store_insert_separator_after (GIMP_INT_STORE (store), - GIMP_LAYER_MODE_BURN_LEGACY, -1); + GIMP_LAYER_MODE_LINEAR_BURN, -1); gimp_int_store_insert_separator_after (GIMP_INT_STORE (store), - GIMP_LAYER_MODE_HARDLIGHT_LEGACY, -1); + GIMP_LAYER_MODE_LINEAR_LIGHT, -1); gimp_int_store_insert_separator_after (GIMP_INT_STORE (store), GIMP_LAYER_MODE_DIVIDE_LEGACY, -1); diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h index 47fad3ac0f..d322eb5577 100644 --- a/libgimp/gimpenums.h +++ b/libgimp/gimpenums.h @@ -131,7 +131,17 @@ typedef enum GIMP_LAYER_MODE_GRAIN_EXTRACT, GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR, GIMP_LAYER_MODE_GRAIN_MERGE, - GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR + GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR, + GIMP_LAYER_MODE_VIVID_LIGHT, + GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR, + GIMP_LAYER_MODE_PIN_LIGHT, + GIMP_LAYER_MODE_PIN_LIGHT_LINEAR, + GIMP_LAYER_MODE_LINEAR_LIGHT, + GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR, + GIMP_LAYER_MODE_EXCLUSION, + GIMP_LAYER_MODE_EXCLUSION_LINEAR, + GIMP_LAYER_MODE_LINEAR_BURN, + GIMP_LAYER_MODE_LINEAR_BURN_LINEAR } GimpLayerMode; diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index 5e3da4d59f..e7dd350424 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -752,7 +752,17 @@ package Gimp::CodeGen::enums; GIMP_LAYER_MODE_GRAIN_EXTRACT GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR GIMP_LAYER_MODE_GRAIN_MERGE - GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR) ], + GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR + GIMP_LAYER_MODE_VIVID_LIGHT + GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR + GIMP_LAYER_MODE_PIN_LIGHT + GIMP_LAYER_MODE_PIN_LIGHT_LINEAR + GIMP_LAYER_MODE_LINEAR_LIGHT + GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR + GIMP_LAYER_MODE_EXCLUSION + GIMP_LAYER_MODE_EXCLUSION_LINEAR + GIMP_LAYER_MODE_LINEAR_BURN + GIMP_LAYER_MODE_LINEAR_BURN_LINEAR) ], mapping => { GIMP_LAYER_MODE_NORMAL_NON_LINEAR => '0', GIMP_LAYER_MODE_DISSOLVE => '1', GIMP_LAYER_MODE_BEHIND => '2', @@ -815,7 +825,17 @@ package Gimp::CodeGen::enums; GIMP_LAYER_MODE_GRAIN_EXTRACT => '59', GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR => '60', GIMP_LAYER_MODE_GRAIN_MERGE => '61', - GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR => '62' } + GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR => '62', + GIMP_LAYER_MODE_VIVID_LIGHT => '63', + GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR => '64', + GIMP_LAYER_MODE_PIN_LIGHT => '65', + GIMP_LAYER_MODE_PIN_LIGHT_LINEAR => '66', + GIMP_LAYER_MODE_LINEAR_LIGHT => '67', + GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR => '68', + GIMP_LAYER_MODE_EXCLUSION => '69', + GIMP_LAYER_MODE_EXCLUSION_LINEAR => '70', + GIMP_LAYER_MODE_LINEAR_BURN => '71', + GIMP_LAYER_MODE_LINEAR_BURN_LINEAR => '72' } }, GimpBrushApplicationMode => { contig => 1,