diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index ca59792f2..329efb102 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -383,6 +383,7 @@ std::map> {"folderLinkIconColor", COLOR}, {"folderLinkIconColorEnd", COLOR}, {"folderLinkIconGradientType", STRING}, + {"interpolation", STRING}, {"opacity", FLOAT}, {"visible", BOOLEAN}, {"zIndex", FLOAT}}}, diff --git a/es-core/src/components/BadgeComponent.cpp b/es-core/src/components/BadgeComponent.cpp index 30a0f75ff..609b22b8c 100644 --- a/es-core/src/components/BadgeComponent.cpp +++ b/es-core/src/components/BadgeComponent.cpp @@ -76,6 +76,7 @@ BadgeComponent::BadgeComponent() , mFlexboxComponent {mFlexboxItems} , mBadgeTypes {{SLOT_COLLECTION, SLOT_FOLDER, SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDGAME, SLOT_BROKEN, SLOT_CONTROLLER, SLOT_ALTEMULATOR, SLOT_MANUAL}} + , mLinearInterpolation {false} { mBadgeIcons[SLOT_COLLECTION] = ":/graphics/badge_collection.svg"; mBadgeIcons[SLOT_FOLDER] = ":/graphics/badge_folder.svg"; @@ -300,6 +301,21 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, } } + if (elem->has("interpolation")) { + const std::string& interpolation {elem->get("interpolation")}; + if (interpolation == "linear") { + mLinearInterpolation = true; + } + else if (interpolation == "nearest") { + mLinearInterpolation = false; + } + else { + LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, property " + "\"interpolation\" for element \"" + << element.substr(7) << "\" defined as \"" << interpolation << "\""; + } + } + unsigned int badgeIconColorShift {0xFFFFFFFF}; unsigned int badgeIconColorShiftEnd {0xFFFFFFFF}; bool badgeIconColorGradientHorizontal {true}; @@ -417,9 +433,11 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, item.label = slot; ImageComponent badgeImage {false, false}; + badgeImage.setLinearInterpolation(mLinearInterpolation); badgeImage.setImage(mBadgeIcons[slot]); item.baseImage = badgeImage; item.overlayImage = ImageComponent {false, false}; + item.overlayImage.setLinearInterpolation(mLinearInterpolation); item.baseImage.setColorShift(badgeIconColorShift); item.baseImage.setColorShiftEnd(badgeIconColorShiftEnd); diff --git a/es-core/src/components/BadgeComponent.h b/es-core/src/components/BadgeComponent.h index 6b1c88475..e85dd0013 100644 --- a/es-core/src/components/BadgeComponent.h +++ b/es-core/src/components/BadgeComponent.h @@ -62,6 +62,8 @@ private: std::vector mBadgeTypes; std::map mBadgeIcons; + + bool mLinearInterpolation; }; #endif // ES_CORE_COMPONENTS_BADGE_COMPONENT_H