(Conditionally) add further dithering algorithms

This commit is contained in:
jpirnay
2026-04-06 17:23:29 +02:00
parent 0ba4626157
commit 4f031b00b1
8 changed files with 102 additions and 6 deletions
@@ -13,12 +13,15 @@ struct ImageDimensions {
enum class ImageDitherMode : uint8_t {
Bayer = 0,
#ifdef ENABLE_IMAGE_DITHERING_EXTENSION
Atkinson = 1,
DiffusedBayer = 2,
#endif
COUNT,
};
inline ImageDitherMode imageDitherModeFromSetting(uint8_t value) {
#ifdef ENABLE_IMAGE_DITHERING_EXTENSION
switch (static_cast<ImageDitherMode>(value)) {
case ImageDitherMode::Bayer:
case ImageDitherMode::Atkinson:
@@ -28,14 +31,20 @@ inline ImageDitherMode imageDitherModeFromSetting(uint8_t value) {
default:
return ImageDitherMode::Bayer;
}
#else
(void)value;
return ImageDitherMode::Bayer;
#endif
}
inline const char* getImageDitherCacheSuffix(ImageDitherMode mode) {
switch (mode) {
#ifdef ENABLE_IMAGE_DITHERING_EXTENSION
case ImageDitherMode::Atkinson:
return ".atkinson";
case ImageDitherMode::DiffusedBayer:
return ".diffused-bayer";
#endif
case ImageDitherMode::Bayer:
case ImageDitherMode::COUNT:
default: