Re-add Temperture adjustment (#1710)

* Add Temperature adjustment

* Add Temperature adjustment - add missing cmake updates

* Add missing ENABLE_MDNS guards

* Reapply temperature on JSONAPI

* Integrate color temperature into RGB transformations

* Fix imagestream update

* fix cast

* Cleanups

* Windows Fix

* Fix inner loop

* Simplify

* Reapply default temperature setting

* Fix adjustments calculation

* Updates
This commit is contained in:
LordGrey
2024-12-28 20:45:10 +01:00
committed by GitHub
parent bc3ea9de42
commit d16142d28e
22 changed files with 371 additions and 154 deletions

View File

@@ -152,6 +152,13 @@
"required" : false,
"minimum" : 0.1,
"maximum": 10.0
},
"temperature" :
{
"type" : "integer",
"required" : false,
"minimum" : 1000,
"maximum": 40000
}
},
"additionalProperties": false

View File

@@ -27,6 +27,7 @@
#include <utils/jsonschema/QJsonFactory.h>
#include <utils/jsonschema/QJsonSchemaChecker.h>
#include <utils/ColorSys.h>
#include <utils/KelvinToRgb.h>
#include <utils/Process.h>
#include <utils/JsonUtils.h>
@@ -640,6 +641,7 @@ void JsonAPI::applyTransforms(const QJsonObject &adjustment, ColorAdjustment *co
applyTransform("backlightColored", adjustment, colorAdjustment->_rgbTransform, &RgbTransform::setBacklightColored);
applyTransform("brightness", adjustment, colorAdjustment->_rgbTransform, &RgbTransform::setBrightness);
applyTransform("brightnessCompensation", adjustment, colorAdjustment->_rgbTransform, &RgbTransform::setBrightnessCompensation);
applyTransform("temperature", adjustment, colorAdjustment->_rgbTransform, &RgbTransform::setTemperature);
applyTransform("saturationGain", adjustment, colorAdjustment->_okhsvTransform, &OkhsvTransform::setSaturationGain);
applyTransform("brightnessGain", adjustment, colorAdjustment->_okhsvTransform, &OkhsvTransform::setBrightnessGain);
}
@@ -669,6 +671,14 @@ void JsonAPI::applyTransform(const QString &transformName, const QJsonObject &ad
}
}
template<typename T>
void JsonAPI::applyTransform(const QString &transformName, const QJsonObject &adjustment, T &transform, void (T::*setFunction)(int))
{
if (adjustment.contains(transformName)) {
(transform.*setFunction)(adjustment[transformName].toInt());
}
}
template<typename T>
void JsonAPI::applyTransform(const QString &transformName, const QJsonObject &adjustment, T &transform, void (T::*setFunction)(uint8_t))
{

View File

@@ -84,6 +84,8 @@ QJsonArray JsonInfo::getAdjustmentInfo(const Hyperion* hyperion, Logger* log)
adjustment["saturationGain"] = colorAdjustment->_okhsvTransform.getSaturationGain();
adjustment["brightnessGain"] = colorAdjustment->_okhsvTransform.getBrightnessGain();
adjustment["temperature"] = colorAdjustment->_rgbTransform.getTemperature();
adjustmentArray.append(adjustment);
}
return adjustmentArray;