add difference blending mode, also fix error in last commit
This commit is contained in:
parent
73a778a4d0
commit
c0e004bd61
@ -1235,6 +1235,9 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
|
|||||||
case MASK_BLEND_REPLACE:
|
case MASK_BLEND_REPLACE:
|
||||||
value = (value * (1.0f - layer->alpha)) + (value_layer * layer->alpha);
|
value = (value * (1.0f - layer->alpha)) + (value_layer * layer->alpha);
|
||||||
break;
|
break;
|
||||||
|
case MASK_BLEND_DIFFERENCE:
|
||||||
|
value = fabsf(value - value_layer);
|
||||||
|
break;
|
||||||
default: /* same as add */
|
default: /* same as add */
|
||||||
BLI_assert(0);
|
BLI_assert(0);
|
||||||
value += value_layer;
|
value += value_layer;
|
||||||
@ -1243,7 +1246,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
|
|||||||
|
|
||||||
/* clamp after applying each layer so we don't get
|
/* clamp after applying each layer so we don't get
|
||||||
* issues subtracting after accumulating over 1.0f */
|
* issues subtracting after accumulating over 1.0f */
|
||||||
return CLAMPIS(value, 0.0f, 1.0f);
|
CLAMP(value, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -173,6 +173,7 @@ enum {
|
|||||||
MASK_BLEND_DARKEN = 3,
|
MASK_BLEND_DARKEN = 3,
|
||||||
MASK_BLEND_MUL = 4,
|
MASK_BLEND_MUL = 4,
|
||||||
MASK_BLEND_REPLACE = 5,
|
MASK_BLEND_REPLACE = 5,
|
||||||
|
MASK_BLEND_DIFFERENCE = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/* masklay->blend_flag */
|
/* masklay->blend_flag */
|
||||||
|
@ -585,6 +585,7 @@ static void rna_def_mask_layer(BlenderRNA *brna)
|
|||||||
{MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
|
{MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
|
||||||
{MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
|
{MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
|
||||||
{MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
|
{MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
|
||||||
|
{MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
|
||||||
{0, NULL, 0, NULL, NULL}
|
{0, NULL, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user