[Bf-blender-cvs] [f33107dd3e5] temp-gpencil-fill: GPencil: For Invert filling be sure there are two pixels thickness
Antonio Vazquez
noreply at git.blender.org
Mon Feb 8 10:58:29 CET 2021
Commit: f33107dd3e5a0fcb24a86b4ffbc38dff3d308f3d
Author: Antonio Vazquez
Date: Mon Feb 8 10:58:24 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rBf33107dd3e5a0fcb24a86b4ffbc38dff3d308f3d
GPencil: For Invert filling be sure there are two pixels thickness
Now a pixel is added to get a minimum thickness of 2 pixels. This avoid false contacts with empty pixels.
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 7ae0027cf13..f595d0f5b35 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -998,18 +998,24 @@ static void gpencil_invert_image(tGPDfill *tgpf)
ibuf = BKE_image_acquire_ibuf(tgpf->ima, NULL, &lock);
const int maxpixel = (ibuf->x * ibuf->y) - 1;
+ const int center = ibuf->x / 2;
for (int v = maxpixel; v != 0; v--) {
float color[4];
get_pixel(ibuf, v, color);
- /* Green. */
+ /* Green->Red. */
if (color[1] == 1.0f) {
set_pixel(ibuf, v, fill_col[0]);
}
+ /* Red->Green */
else if (color[0] == 1.0f) {
set_pixel(ibuf, v, fill_col[1]);
+ /* Add thickness of 2 pixels to avoid too thin lines. */
+ int offset = (v % ibuf->x < center) ? 1 : -1;
+ set_pixel(ibuf, v + offset, fill_col[1]);
}
else {
+ /* Set to Transparent. */
set_pixel(ibuf, v, fill_col[2]);
}
}
More information about the Bf-blender-cvs
mailing list