diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-28 15:36:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-28 15:36:01 +0400 |
commit | 3ec212fd71ee5b8aed165d4361f0c9d0f7152b9e (patch) | |
tree | bc8b6511ecc33769d9b4a35248c436c335ee28ba | |
parent | f405d8fa5353cf0c839b44105048251fd4a1a481 (diff) |
patch [#32195] MASKS: Canonical Porter Duff algorithm for merge missing.
from Troy Sobotka (sobotka)
This gives nicer blending then 'ADD', setting as default for new masks.
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask_rasterize.c | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mask_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mask.c | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index df38cc9571f..a088a91000c 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -156,6 +156,7 @@ MaskLayer *BKE_mask_layer_new(Mask *mask, const char *name) mask->masklay_tot++; + masklay->blend = MASK_BLEND_MERGE; masklay->alpha = 1.0f; return masklay; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index b05c1ad4eaa..da0070f0c09 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1251,6 +1251,9 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x } switch (layer->blend) { + case MASK_BLEND_MERGE: + value += value_layer * (1.0f - value); + break; case MASK_BLEND_ADD: value += value_layer; break; diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index 60bc3ee0ffc..e7322263a6b 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -173,7 +173,8 @@ enum { MASK_BLEND_DARKEN = 3, MASK_BLEND_MUL = 4, MASK_BLEND_REPLACE = 5, - MASK_BLEND_DIFFERENCE = 6 + MASK_BLEND_DIFFERENCE = 6, + MASK_BLEND_MERGE = 7 }; /* masklay->blend_flag */ diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index d197936f35e..2d972d26398 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -573,6 +573,7 @@ static void rna_def_maskSpline(BlenderRNA *brna) static void rna_def_mask_layer(BlenderRNA *brna) { static EnumPropertyItem masklay_blend_mode_items[] = { + {MASK_BLEND_MERGE, "MERGE", 0, "Merge", ""}, {MASK_BLEND_ADD, "ADD", 0, "Add", ""}, {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""}, {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, |