diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-02-22 22:03:34 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-02-22 22:03:34 +0300 |
commit | 529f8918780dc5b998d9f031c51d405af100ca5c (patch) | |
tree | b1b429089f8420e0515de17aa5c6df5742a987a8 /source/blender/editors | |
parent | ad3ee84f4e5ff3aa7c7b7b104a32b856e3a2cd9a (diff) |
GPencil: Make Fill Dilate expand outside stroke
To keep consistency with the new contract option, the dilate now expand the shape beyond the internal closed area.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_fill.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 8be34a35ca9..8e5161b3245 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1097,7 +1097,7 @@ static void gpencil_erase_processed_area(tGPDfill *tgpf) /** * Naive dilate * - * Expand green areas into enclosing red areas. + * Expand green areas into enclosing red or transparent areas. * Using stack prevents creep when replacing colors directly. * <pre> * ----------- @@ -1110,8 +1110,8 @@ static void gpencil_erase_processed_area(tGPDfill *tgpf) */ static bool dilate_shape(ImBuf *ibuf) { -#define IS_RED (color[0] == 1.0f) #define IS_GREEN (color[1] == 1.0f) +#define IS_NOT_GREEN (color[1] != 1.0f) bool done = false; @@ -1140,7 +1140,7 @@ static bool dilate_shape(ImBuf *ibuf) if (v - 1 >= 0) { index = v - 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); lt = index; } @@ -1149,7 +1149,7 @@ static bool dilate_shape(ImBuf *ibuf) if (v + 1 <= maxpixel) { index = v + 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); rt = index; } @@ -1158,7 +1158,7 @@ static bool dilate_shape(ImBuf *ibuf) if (v + ibuf->x <= max_size) { index = v + ibuf->x; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); tp = index; } @@ -1167,7 +1167,7 @@ static bool dilate_shape(ImBuf *ibuf) if (v - ibuf->x >= 0) { index = v - ibuf->x; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); bm = index; } @@ -1176,7 +1176,7 @@ static bool dilate_shape(ImBuf *ibuf) if (tp && lt) { index = tp - 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); } } @@ -1184,7 +1184,7 @@ static bool dilate_shape(ImBuf *ibuf) if (tp && rt) { index = tp + 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); } } @@ -1192,7 +1192,7 @@ static bool dilate_shape(ImBuf *ibuf) if (bm && lt) { index = bm - 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); } } @@ -1200,7 +1200,7 @@ static bool dilate_shape(ImBuf *ibuf) if (bm && rt) { index = bm + 1; get_pixel(ibuf, index, color); - if (IS_RED) { + if (IS_NOT_GREEN) { BLI_stack_push(stack, &index); } } @@ -1218,8 +1218,8 @@ static bool dilate_shape(ImBuf *ibuf) return done; -#undef IS_RED #undef IS_GREEN +#undef IS_NOT_GREEN } /** |