Implement transparency handling

Though none of this has been tested so far...
This commit is contained in:
ISSOtm
2022-03-13 11:28:20 +01:00
committed by Eldred Habert
parent e86eb9337a
commit 3c9d5b05d6
6 changed files with 32 additions and 24 deletions

View File

@@ -543,17 +543,19 @@ uint8_t Palette::indexOf(uint16_t color) const {
}
auto Palette::begin() -> decltype(colors)::iterator {
return colors.begin();
// Skip the first slot if reserved for transparency
return colors.begin() + options.hasTransparentPixels;
}
auto Palette::end() -> decltype(colors)::iterator {
return std::find(colors.begin(), colors.end(), UINT16_MAX);
return std::find(begin(), colors.end(), UINT16_MAX);
}
auto Palette::begin() const -> decltype(colors)::const_iterator {
return colors.begin();
// Skip the first slot if reserved for transparency
return colors.begin() + options.hasTransparentPixels;
}
auto Palette::end() const -> decltype(colors)::const_iterator {
return std::find(colors.begin(), colors.end(), UINT16_MAX);
return std::find(begin(), colors.end(), UINT16_MAX);
}
uint8_t Palette::size() const {