add new mask blend mode: 'Merge Subtract'. gives better results when using feather...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 22 Aug 2012 11:58:59 +0000 (11:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 22 Aug 2012 11:58:59 +0000 (11:58 +0000)
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/makesdna/DNA_mask_types.h
source/blender/makesrna/intern/rna_mask.c

index 1e1cbf8610edb7ae9cd58b61ede5efec901a1c3a..a6ceba588d28748fe34915346693c21df8802067 100644 (file)
@@ -158,7 +158,7 @@ MaskLayer *BKE_mask_layer_new(Mask *mask, const char *name)
 
        mask->masklay_tot++;
 
-       masklay->blend = MASK_BLEND_MERGE;
+       masklay->blend = MASK_BLEND_MERGE_ADD;
        masklay->alpha = 1.0f;
 
        return masklay;
index d39be3b8ed62679f3f0672b850d1a92e48c2bdcf..48e55601469eaabc62a0771bdf53136d198e1d8f 100644 (file)
@@ -1282,9 +1282,12 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
                }
 
                switch (layer->blend) {
-                       case MASK_BLEND_MERGE:
+                       case MASK_BLEND_MERGE_ADD:
                                value += value_layer * (1.0f - value);
                                break;
+                       case MASK_BLEND_MERGE_SUBTRACT:
+                               value -= value_layer * value;
+                               break;
                        case MASK_BLEND_ADD:
                                value += value_layer;
                                break;
index b34a6c9b12f33c2fde7b19eae57e3701ce851058..6c7f7aa2471e3f09bfd5c944857d4b8008f81691 100644 (file)
@@ -168,14 +168,15 @@ enum {
 
 /* masklay->blend */
 enum {
-       MASK_BLEND_ADD         = 0,
-       MASK_BLEND_SUBTRACT    = 1,
-       MASK_BLEND_LIGHTEN     = 2,
-       MASK_BLEND_DARKEN      = 3,
-       MASK_BLEND_MUL         = 4,
-       MASK_BLEND_REPLACE     = 5,
-       MASK_BLEND_DIFFERENCE  = 6,
-       MASK_BLEND_MERGE       = 7
+       MASK_BLEND_ADD             = 0,
+       MASK_BLEND_SUBTRACT        = 1,
+       MASK_BLEND_LIGHTEN         = 2,
+       MASK_BLEND_DARKEN          = 3,
+       MASK_BLEND_MUL             = 4,
+       MASK_BLEND_REPLACE         = 5,
+       MASK_BLEND_DIFFERENCE      = 6,
+       MASK_BLEND_MERGE_ADD       = 7,
+       MASK_BLEND_MERGE_SUBTRACT  = 8
 };
 
 /* masklay->blend_flag */
index f197bf8391d6b0b1b51238dcc78a8e062b81d57b..a6571a2db4f42067ef9b34ead54f4917d1282b72 100644 (file)
@@ -580,7 +580,8 @@ 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_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
+               {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
                {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
                {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
                {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},