mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Adjustment merge + new brightness settings (#359)
* add new rgbtransform * activate rgbtransform * integrate new transform and gamma in adjustment, disable transform * fix brighness limit * advance upper and lower thresholds * start removing color transform * adjust configs/schema * implement json for new color adjustment * finish hyperion-remote extension for new adjustment settings * fix typos * rename luminance to brightness fix jsonapi for new adjustment * fix some bugs in adjustments * fix i18n * fix gamma via json * now brighness values goes from 0-1 with 0.5 is the default for all brighness is equal between the channels. less 0.5 all channels scaled down to new brighness, above 0.5 if possible channel gets brighter - but brighness is not equal between the channels anymore brighness value curve is now exponential instead of linear - this feels more natural * hslv cleanup
This commit is contained in:
@@ -401,102 +401,21 @@ void JsonConnection::setConfig(const QString &jsonString)
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
void JsonConnection::setTransform(const QString &transformId,
|
||||
double *saturation,
|
||||
double *value,
|
||||
double *saturationL,
|
||||
double *luminance,
|
||||
double *luminanceMin,
|
||||
QColor threshold,
|
||||
QColor gamma,
|
||||
QColor blacklevel,
|
||||
QColor whitelevel)
|
||||
{
|
||||
qDebug() << "Set color transforms";
|
||||
|
||||
// create command
|
||||
QJsonObject command, transform;
|
||||
command["command"] = QString("transform");
|
||||
|
||||
if (!transformId.isNull())
|
||||
{
|
||||
transform["id"] = transformId;
|
||||
}
|
||||
|
||||
if (saturation != nullptr)
|
||||
{
|
||||
transform["saturationGain"] = *saturation;
|
||||
}
|
||||
|
||||
if (value != nullptr)
|
||||
{
|
||||
transform["valueGain"] = *value;
|
||||
}
|
||||
|
||||
if (saturationL != nullptr)
|
||||
{
|
||||
transform["saturationLGain"] = *saturationL;
|
||||
}
|
||||
|
||||
if (luminance != nullptr)
|
||||
{
|
||||
transform["luminanceGain"] = *luminance;
|
||||
}
|
||||
|
||||
if (luminanceMin != nullptr)
|
||||
{
|
||||
transform["luminanceMinimum"] = *luminanceMin;
|
||||
}
|
||||
|
||||
if (threshold.isValid())
|
||||
{
|
||||
QJsonArray t;
|
||||
t.append(threshold.red());
|
||||
t.append(threshold.green());
|
||||
t.append(threshold.blue());
|
||||
transform["threshold"] = t;
|
||||
}
|
||||
|
||||
if (gamma.isValid())
|
||||
{
|
||||
QJsonArray g;
|
||||
g.append(gamma.red());
|
||||
g.append(gamma.green());
|
||||
g.append(gamma.blue());
|
||||
transform["gamma"] = g;
|
||||
}
|
||||
|
||||
if (blacklevel.isValid())
|
||||
{
|
||||
QJsonArray b;
|
||||
b.append(blacklevel.red());
|
||||
b.append(blacklevel.green());
|
||||
b.append(blacklevel.blue());
|
||||
transform["blacklevel"] = b;
|
||||
}
|
||||
|
||||
if (whitelevel.isValid())
|
||||
{
|
||||
QJsonArray w;
|
||||
w.append(whitelevel.red());
|
||||
w.append(whitelevel.green());
|
||||
w.append(whitelevel.blue());
|
||||
transform["whitelevel"] = w;
|
||||
}
|
||||
|
||||
command["transform"] = transform;
|
||||
|
||||
// send command message
|
||||
QJsonObject reply = sendMessage(command);
|
||||
|
||||
// parse reply message
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
void JsonConnection::setAdjustment(const QString &adjustmentId,
|
||||
const QColor & redAdjustment,
|
||||
const QColor & greenAdjustment,
|
||||
const QColor & blueAdjustment)
|
||||
void JsonConnection::setAdjustment(
|
||||
const QString & adjustmentId,
|
||||
const QColor & redAdjustment,
|
||||
const QColor & greenAdjustment,
|
||||
const QColor & blueAdjustment,
|
||||
const QColor & cyanAdjustment,
|
||||
const QColor & magentaAdjustment,
|
||||
const QColor & yellowAdjustment,
|
||||
const QColor & whiteAdjustment,
|
||||
const QColor & blackAdjustment,
|
||||
double *gammaR,
|
||||
double *gammaG,
|
||||
double *gammaB,
|
||||
double *brightnessMin,
|
||||
double *brightness)
|
||||
{
|
||||
qDebug() << "Set color adjustments";
|
||||
|
||||
@@ -535,7 +454,51 @@ void JsonConnection::setAdjustment(const QString &adjustmentId,
|
||||
blue.append(blueAdjustment.blue());
|
||||
adjust["blueAdjust"] = blue;
|
||||
}
|
||||
|
||||
if (cyanAdjustment.isValid())
|
||||
{
|
||||
QJsonArray cyan;
|
||||
cyan.append(cyanAdjustment.red());
|
||||
cyan.append(cyanAdjustment.green());
|
||||
cyan.append(cyanAdjustment.blue());
|
||||
adjust["cyanAdjust"] = cyan;
|
||||
}
|
||||
if (magentaAdjustment.isValid())
|
||||
{
|
||||
QJsonArray magenta;
|
||||
magenta.append(magentaAdjustment.red());
|
||||
magenta.append(magentaAdjustment.green());
|
||||
magenta.append(magentaAdjustment.blue());
|
||||
adjust["magentaAdjust"] = magenta;
|
||||
}
|
||||
if (yellowAdjustment.isValid())
|
||||
{
|
||||
QJsonArray yellow;
|
||||
yellow.append(yellowAdjustment.red());
|
||||
yellow.append(yellowAdjustment.green());
|
||||
yellow.append(yellowAdjustment.blue());
|
||||
adjust["yellowAdjust"] = yellow;
|
||||
}
|
||||
if (brightnessMin != nullptr)
|
||||
{
|
||||
adjust["brightnessMin"] = *brightnessMin;
|
||||
}
|
||||
if (brightness != nullptr)
|
||||
{
|
||||
adjust["brightness"] = *brightness;
|
||||
}
|
||||
if (gammaR != nullptr)
|
||||
{
|
||||
adjust["gammaR"] = *gammaR;
|
||||
}
|
||||
if (gammaG != nullptr)
|
||||
{
|
||||
adjust["gammaG"] = *gammaG;
|
||||
}
|
||||
if (gammaB != nullptr)
|
||||
{
|
||||
adjust["gammaB"] = *gammaB;
|
||||
}
|
||||
|
||||
command["adjustment"] = adjust;
|
||||
|
||||
// send command message
|
||||
|
||||
Reference in New Issue
Block a user