Fix fromImage() to avoid missing pixels

Before this, pixels with an alpha < 128 were not taken into account to
build the mask. Now only pixels with alpha = 0 are not taken into
account.
This commit is contained in:
Martín Capello 2024-08-12 11:23:39 -03:00 committed by David Capello
parent 4f6b997101
commit e7f308bbfe

View File

@ -149,7 +149,7 @@ void Mask::fromImage(const Image* image, const gfx::Point& maskOrigin)
for (; maskIt != maskEnd; ++maskIt, ++rgbIt) {
ASSERT(rgbIt != rgbEnd);
color_t c = *rgbIt;
*maskIt = (rgba_geta(c) >= 128); // TODO configurable threshold
*maskIt = (rgba_geta(c) > 0);
}
break;
}
@ -163,7 +163,7 @@ void Mask::fromImage(const Image* image, const gfx::Point& maskOrigin)
for (; maskIt != maskEnd; ++maskIt, ++grayIt) {
ASSERT(grayIt != grayEnd);
color_t c = *grayIt;
*maskIt = (graya_geta(c) >= 128); // TODO configurable threshold
*maskIt = (graya_geta(c) > 0);
}
break;
}