mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added itemSaturation properties to CarouselComponent and GridComponent.
This commit is contained in:
parent
16aacd5953
commit
c260c929b5
|
@ -133,6 +133,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"imageColor", COLOR},
|
{"imageColor", COLOR},
|
||||||
{"imageColorEnd", COLOR},
|
{"imageColorEnd", COLOR},
|
||||||
{"imageGradientType", STRING},
|
{"imageGradientType", STRING},
|
||||||
|
{"imageSaturation", FLOAT},
|
||||||
{"itemTransitions", STRING},
|
{"itemTransitions", STRING},
|
||||||
{"itemHorizontalAlignment", STRING},
|
{"itemHorizontalAlignment", STRING},
|
||||||
{"itemVerticalAlignment", STRING},
|
{"itemVerticalAlignment", STRING},
|
||||||
|
@ -184,6 +185,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"imageColor", COLOR},
|
{"imageColor", COLOR},
|
||||||
{"imageColorEnd", COLOR},
|
{"imageColorEnd", COLOR},
|
||||||
{"imageGradientType", STRING},
|
{"imageGradientType", STRING},
|
||||||
|
{"imageSaturation", FLOAT},
|
||||||
{"backgroundImage", PATH},
|
{"backgroundImage", PATH},
|
||||||
{"backgroundRelativeScale", FLOAT},
|
{"backgroundRelativeScale", FLOAT},
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
|
|
|
@ -147,6 +147,7 @@ private:
|
||||||
unsigned int mImageColorShift;
|
unsigned int mImageColorShift;
|
||||||
unsigned int mImageColorShiftEnd;
|
unsigned int mImageColorShiftEnd;
|
||||||
bool mImageColorGradientHorizontal;
|
bool mImageColorGradientHorizontal;
|
||||||
|
float mImageSaturation;
|
||||||
bool mInstantItemTransitions;
|
bool mInstantItemTransitions;
|
||||||
Alignment mItemHorizontalAlignment;
|
Alignment mItemHorizontalAlignment;
|
||||||
Alignment mItemVerticalAlignment;
|
Alignment mItemVerticalAlignment;
|
||||||
|
@ -199,6 +200,7 @@ CarouselComponent<T>::CarouselComponent()
|
||||||
, mImageColorShift {0xFFFFFFFF}
|
, mImageColorShift {0xFFFFFFFF}
|
||||||
, mImageColorShiftEnd {0xFFFFFFFF}
|
, mImageColorShiftEnd {0xFFFFFFFF}
|
||||||
, mImageColorGradientHorizontal {true}
|
, mImageColorGradientHorizontal {true}
|
||||||
|
, mImageSaturation {1.0f}
|
||||||
, mInstantItemTransitions {false}
|
, mInstantItemTransitions {false}
|
||||||
, mItemHorizontalAlignment {ALIGN_CENTER}
|
, mItemHorizontalAlignment {ALIGN_CENTER}
|
||||||
, mItemVerticalAlignment {ALIGN_CENTER}
|
, mItemVerticalAlignment {ALIGN_CENTER}
|
||||||
|
@ -263,6 +265,8 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
||||||
item->setMaxSize(glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
item->setMaxSize(glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
||||||
item->setImage(entry.data.imagePath);
|
item->setImage(entry.data.imagePath);
|
||||||
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
item->setSaturation(mImageSaturation);
|
||||||
if (mImageColorShift != 0xFFFFFFFF)
|
if (mImageColorShift != 0xFFFFFFFF)
|
||||||
item->setColorShift(mImageColorShift);
|
item->setColorShift(mImageColorShift);
|
||||||
if (mImageColorShiftEnd != mImageColorShift)
|
if (mImageColorShiftEnd != mImageColorShift)
|
||||||
|
@ -281,6 +285,8 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
|
||||||
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
||||||
defaultImage->setImage(entry.data.defaultImagePath);
|
defaultImage->setImage(entry.data.defaultImagePath);
|
||||||
defaultImage->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
defaultImage->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
defaultImage->setSaturation(mImageSaturation);
|
||||||
if (mImageColorShift != 0xFFFFFFFF)
|
if (mImageColorShift != 0xFFFFFFFF)
|
||||||
defaultImage->setColorShift(mImageColorShift);
|
defaultImage->setColorShift(mImageColorShift);
|
||||||
if (mImageColorShiftEnd != mImageColorShift)
|
if (mImageColorShiftEnd != mImageColorShift)
|
||||||
|
@ -348,6 +354,8 @@ void CarouselComponent<T>::updateEntry(Entry& entry, const std::shared_ptr<Theme
|
||||||
item->setMaxSize(glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
item->setMaxSize(glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)));
|
||||||
item->setImage(entry.data.imagePath);
|
item->setImage(entry.data.imagePath);
|
||||||
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
item->setSaturation(mImageSaturation);
|
||||||
if (mImageColorShift != 0xFFFFFFFF)
|
if (mImageColorShift != 0xFFFFFFFF)
|
||||||
item->setColorShift(mImageColorShift);
|
item->setColorShift(mImageColorShift);
|
||||||
if (mImageColorShiftEnd != mImageColorShift)
|
if (mImageColorShiftEnd != mImageColorShift)
|
||||||
|
@ -1116,6 +1124,9 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem->has("imageSaturation"))
|
||||||
|
mImageSaturation = glm::clamp(elem->get<float>("imageSaturation"), 0.0f, 1.0f);
|
||||||
|
|
||||||
if (elem->has("imageInterpolation")) {
|
if (elem->has("imageInterpolation")) {
|
||||||
const std::string& imageInterpolation {elem->get<std::string>("imageInterpolation")};
|
const std::string& imageInterpolation {elem->get<std::string>("imageInterpolation")};
|
||||||
if (imageInterpolation == "linear") {
|
if (imageInterpolation == "linear") {
|
||||||
|
|
|
@ -148,6 +148,7 @@ private:
|
||||||
unsigned int mImageColor;
|
unsigned int mImageColor;
|
||||||
unsigned int mImageColorEnd;
|
unsigned int mImageColorEnd;
|
||||||
bool mImageColorGradientHorizontal;
|
bool mImageColorGradientHorizontal;
|
||||||
|
float mImageSaturation;
|
||||||
std::unique_ptr<ImageComponent> mBackgroundImage;
|
std::unique_ptr<ImageComponent> mBackgroundImage;
|
||||||
std::string mBackgroundImagePath;
|
std::string mBackgroundImagePath;
|
||||||
float mBackgroundRelativeScale;
|
float mBackgroundRelativeScale;
|
||||||
|
@ -204,6 +205,7 @@ GridComponent<T>::GridComponent()
|
||||||
, mImageColor {0xFFFFFFFF}
|
, mImageColor {0xFFFFFFFF}
|
||||||
, mImageColorEnd {0xFFFFFFFF}
|
, mImageColorEnd {0xFFFFFFFF}
|
||||||
, mImageColorGradientHorizontal {true}
|
, mImageColorGradientHorizontal {true}
|
||||||
|
, mImageSaturation {1.0f}
|
||||||
, mBackgroundRelativeScale {1.0f}
|
, mBackgroundRelativeScale {1.0f}
|
||||||
, mBackgroundColor {0xFFFFFFFF}
|
, mBackgroundColor {0xFFFFFFFF}
|
||||||
, mBackgroundColorEnd {0xFFFFFFFF}
|
, mBackgroundColorEnd {0xFFFFFFFF}
|
||||||
|
@ -256,6 +258,8 @@ void GridComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeData>&
|
||||||
item->setCroppedSize(mItemSize * mImageRelativeScale);
|
item->setCroppedSize(mItemSize * mImageRelativeScale);
|
||||||
item->setImage(entry.data.imagePath);
|
item->setImage(entry.data.imagePath);
|
||||||
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
item->setSaturation(mImageSaturation);
|
||||||
if (mImageColor != 0xFFFFFFFF)
|
if (mImageColor != 0xFFFFFFFF)
|
||||||
item->setColorShift(mImageColor);
|
item->setColorShift(mImageColor);
|
||||||
if (mImageColorEnd != mImageColor) {
|
if (mImageColorEnd != mImageColor) {
|
||||||
|
@ -280,6 +284,8 @@ void GridComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeData>&
|
||||||
defaultImage->setCroppedSize(mItemSize * mImageRelativeScale);
|
defaultImage->setCroppedSize(mItemSize * mImageRelativeScale);
|
||||||
defaultImage->setImage(entry.data.defaultImagePath);
|
defaultImage->setImage(entry.data.defaultImagePath);
|
||||||
defaultImage->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
defaultImage->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
defaultImage->setSaturation(mImageSaturation);
|
||||||
if (mImageColor != 0xFFFFFFFF)
|
if (mImageColor != 0xFFFFFFFF)
|
||||||
defaultImage->setColorShift(mImageColor);
|
defaultImage->setColorShift(mImageColor);
|
||||||
if (mImageColorEnd != mImageColor) {
|
if (mImageColorEnd != mImageColor) {
|
||||||
|
@ -329,6 +335,8 @@ void GridComponent<T>::updateEntry(Entry& entry, const std::shared_ptr<ThemeData
|
||||||
item->setCroppedSize(mItemSize * mImageRelativeScale);
|
item->setCroppedSize(mItemSize * mImageRelativeScale);
|
||||||
item->setImage(entry.data.imagePath);
|
item->setImage(entry.data.imagePath);
|
||||||
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
item->applyTheme(theme, "system", "", ThemeFlags::ALL);
|
||||||
|
if (mImageSaturation != 1.0)
|
||||||
|
item->setSaturation(mImageSaturation);
|
||||||
if (mImageColor != 0xFFFFFFFF)
|
if (mImageColor != 0xFFFFFFFF)
|
||||||
item->setColorShift(mImageColor);
|
item->setColorShift(mImageColor);
|
||||||
if (mImageColorEnd != mImageColor) {
|
if (mImageColorEnd != mImageColor) {
|
||||||
|
@ -1019,6 +1027,9 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem->has("imageSaturation"))
|
||||||
|
mImageSaturation = glm::clamp(elem->get<float>("imageSaturation"), 0.0f, 1.0f);
|
||||||
|
|
||||||
if (elem->has("unfocusedItemOpacity"))
|
if (elem->has("unfocusedItemOpacity"))
|
||||||
mUnfocusedItemOpacity = glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
mUnfocusedItemOpacity = glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue