[gimp] app: add GIMP_LAYER_MODE_FLAG_SUBTRACTIVE
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add GIMP_LAYER_MODE_FLAG_SUBTRACTIVE
- Date: Wed, 8 Mar 2017 19:18:54 +0000 (UTC)
commit 40c0ea4fe14dda3201f7d7c6a102bbf87b464199
Author: Ell <ell_se yahoo com>
Date: Wed Mar 8 06:36:39 2017 -0500
app: add GIMP_LAYER_MODE_FLAG_SUBTRACTIVE
Most modes only modify the *color* of overlapping dest/src regions,
however, erase and color-erase may also reduce their *alpha*, i.e.,
eliminate some of the overlapping content. Flag these modes with
the new SUBTRACTIVE flag, as they require more general compositing
code. The next commit adds the said code.
app/operations/layer-modes/gimp-layer-modes.c | 17 +++++++++++++++--
app/operations/layer-modes/gimp-layer-modes.h | 2 ++
app/operations/operations-enums.h | 1 +
3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/app/operations/layer-modes/gimp-layer-modes.c b/app/operations/layer-modes/gimp-layer-modes.c
index 30161e0..485554e 100644
--- a/app/operations/layer-modes/gimp-layer-modes.c
+++ b/app/operations/layer-modes/gimp-layer-modes.c
@@ -405,7 +405,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.function = gimp_operation_color_erase_process,
.flags = GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
- GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
+ GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE |
+ GIMP_LAYER_MODE_FLAG_SUBTRACTIVE,
.context = GIMP_LAYER_MODE_CONTEXT_PAINT |
GIMP_LAYER_MODE_CONTEXT_FADE,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_SRC_ATOP,
@@ -804,7 +805,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.op_name = "gimp:erase",
.function = gimp_operation_erase_process,
- .flags = GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE,
+ .flags = GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
+ GIMP_LAYER_MODE_FLAG_SUBTRACTIVE,
.context = GIMP_LAYER_MODE_CONTEXT_FADE,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_SRC_ATOP,
.composite_mode = GIMP_LAYER_COMPOSITE_SRC_ATOP,
@@ -1149,6 +1151,17 @@ gimp_layer_mode_is_composite_mode_mutable (GimpLayerMode mode)
return (info->flags & GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE) == 0;
}
+gboolean
+gimp_layer_mode_is_subtractive (GimpLayerMode mode)
+{
+ const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+
+ if (! info)
+ return FALSE;
+
+ return (info->flags & GIMP_LAYER_MODE_FLAG_SUBTRACTIVE) != 0;
+}
+
GimpLayerColorSpace
gimp_layer_mode_get_blend_space (GimpLayerMode mode)
{
diff --git a/app/operations/layer-modes/gimp-layer-modes.h b/app/operations/layer-modes/gimp-layer-modes.h
index c5a79f0..9b49fb6 100644
--- a/app/operations/layer-modes/gimp-layer-modes.h
+++ b/app/operations/layer-modes/gimp-layer-modes.h
@@ -31,6 +31,8 @@ gboolean gimp_layer_mode_is_blend_space_mutable (GimpLayerMode
gboolean gimp_layer_mode_is_composite_space_mutable (GimpLayerMode mode);
gboolean gimp_layer_mode_is_composite_mode_mutable (GimpLayerMode mode);
+gboolean gimp_layer_mode_is_subtractive (GimpLayerMode mode);
+
GimpLayerColorSpace gimp_layer_mode_get_blend_space (GimpLayerMode mode);
GimpLayerColorSpace gimp_layer_mode_get_composite_space (GimpLayerMode mode);
GimpLayerCompositeMode gimp_layer_mode_get_composite_mode (GimpLayerMode mode);
diff --git a/app/operations/operations-enums.h b/app/operations/operations-enums.h
index b2810cb..c5bf617 100644
--- a/app/operations/operations-enums.h
+++ b/app/operations/operations-enums.h
@@ -173,6 +173,7 @@ typedef enum /*< pdb-skip, skip >*/
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE = 1 << 1,
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE = 1 << 2,
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE = 1 << 3,
+ GIMP_LAYER_MODE_FLAG_SUBTRACTIVE = 1 << 4
} GimpLayerModeFlags;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]