Only register colors inside the -L/--slice region, including transparent color

Fixes #2074
This commit is contained in:
Rangi
2026-09-12 12:52:35 -04:00
parent 439a7a1828
commit 8a7019e1f8
7 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -179,8 +179,13 @@ struct Image {
std::unordered_set<std::pair<uint32_t, uint32_t>, decltype(hashPair)> fusions;
// Register colors from `png` into `colors`
for (uint32_t y = 0; y < png.height; ++y) {
for (uint32_t x = 0; x < png.width; ++x) {
uint32_t const pxLeft = options.inputSlice.width ? options.inputSlice.left : 0;
uint32_t const pxTop = options.inputSlice.height ? options.inputSlice.top : 0;
uint32_t const pxRight = options.inputSlice.width ? options.inputSlice.right() : png.width;
uint32_t const pxBottom =
options.inputSlice.height ? options.inputSlice.bottom() : png.height;
for (uint32_t y = pxTop; y < pxBottom; ++y) {
for (uint32_t x = pxLeft; x < pxRight; ++x) {
if (Rgba const &color = pixel(x, y); color.isAmbiguous()) {
// Report ambiguously transparent or opaque colors
if (uint32_t css = color.toCSS(); ambiguous.find(css) == ambiguous.end()) {
+1
View File
@@ -0,0 +1 @@
-L 8,8:1,1
+1
View File
@@ -0,0 +1 @@
<フ<フ<フ<フ<フ<フ<フ<フ
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B