First color of -c palettes with transparent pixels is transparent $8000, not unspecified $ffff

This commit is contained in:
Rangi
2026-09-10 16:41:32 -04:00
parent 25240e9fc0
commit 9c5e872f9c
2 changed files with 12 additions and 2 deletions
+12 -2
View File
@@ -365,8 +365,9 @@ static std::pair<std::vector<size_t>, std::vector<Palette>>
// LCOV_EXCL_STOP
std::vector<Palette> palettes(nbPalettes);
// If the image contains at least one transparent pixel, force transparency in the first slot of
// all palettes
// all palettes.
if (options.hasTransparentPixels) {
for (Palette &pal : palettes) {
pal.colors[0] = Rgba::transparent;
@@ -400,8 +401,17 @@ static std::pair<std::vector<size_t>, std::vector<Palette>>
static std::pair<std::vector<size_t>, std::vector<Palette>>
makePalsAsSpecified(std::vector<ColorSet> const &colorSets) {
// Convert the palette spec to actual palettes
std::vector<Palette> palettes(options.palSpec.size());
// If the image contains at least one transparent pixel, force transparency in the first slot of
// all palettes
if (options.hasTransparentPixels) {
for (Palette &pal : palettes) {
pal.colors[0] = Rgba::transparent;
}
}
// Convert the palette spec to actual palettes
bool gaveDeprecationWarning = false;
for (auto [spec, pal] : zip(options.palSpec, palettes)) {
bool skipFirst = false;
Binary file not shown.