Add Temperature adjustment

This commit is contained in:
LordGrey
2022-12-22 20:10:44 +01:00
parent 1189f86c1a
commit 30b1a1b25f
18 changed files with 666 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
#ifndef COLORADJUSTMENT_H
#define COLORADJUSTMENT_H
// STL includes
// Qt includes
#include <QString>
// Utils includes

View File

@@ -0,0 +1,18 @@
#pragma once
// Qt includes
#include <QString>
// Utils includes
#include <utils/RgbChannelCorrection.h>
class ColorCorrection
{
public:
/// Unique identifier for this color correction
QString _id;
/// The RGB correction
RgbChannelCorrection _rgbCorrection;
};

View File

@@ -22,6 +22,7 @@
#include <hyperion/LedString.h>
#include <hyperion/PriorityMuxer.h>
#include <hyperion/ColorAdjustment.h>
#include <hyperion/ColorCorrection.h>
#include <hyperion/ComponentRegister.h>
#if defined(ENABLE_EFFECTENGINE)
@@ -48,6 +49,7 @@ class LinearColorSmoothing;
class EffectEngine;
#endif
class MultiColorAdjustment;
class MultiColorCorrection;
class ColorAdjustment;
class SettingsManager;
class BGEffectHandler;
@@ -181,15 +183,30 @@ public slots:
///
QStringList getAdjustmentIds() const;
///
/// Returns the list with unique correction identifiers
/// @return The list with correction identifiers
///
QStringList getTemperatureIds() const;
///
/// Returns the ColorAdjustment with the given identifier
/// @return The adjustment with the given identifier (or nullptr if the identifier does not exist)
///
ColorAdjustment * getAdjustment(const QString& id) const;
///
/// Returns the ColorCorrection with the given identifier
/// @return The correction with the given identifier (or nullptr if the identifier does not exist)
///
ColorCorrection * getTemperature(const QString& id) const;
/// Tell Hyperion that the corrections have changed and the leds need to be updated
void adjustmentsUpdated();
/// Tell Hyperion that the corrections have changed and the leds need to be updated
void temperaturesUpdated();
///
/// Clears the given priority channel. This will switch the led-colors to the colors of the next
/// lower priority channel (or off if no more channels are set)
@@ -566,6 +583,9 @@ private:
/// The adjustment from raw colors to led colors
MultiColorAdjustment * _raw2ledAdjustment;
/// The temperature from raw colors to led colors
MultiColorCorrection * _raw2ledTemperature;
/// The actual LedDeviceWrapper
LedDeviceWrapper* _ledDeviceWrapper;

View File

@@ -0,0 +1,69 @@
#pragma once
// STL includes
#include <vector>
// Utils includes
#include <utils/ColorRgb.h>
#include "utils/Logger.h"
// Hyperion includes
#include <hyperion/ColorCorrection.h>
///
/// The LedColorCorrection is responsible for performing color correction from 'raw' colors
/// received as input to colors mapped to match the color-properties of the leds.
///
class MultiColorCorrection
{
public:
MultiColorCorrection(int ledCnt);
~MultiColorCorrection();
/**
* Adds a new ColorCorrection to this MultiColorCorrection
*
* @param Correction The new ColorCorrection (ownership is transfered)
*/
void addCorrection(ColorCorrection * correction);
void setCorrectionForLed(const QString& id, int startLed, int endLed);
bool verifyCorrections() const;
///
/// Returns the identifier of all the unique ColorCorrection
///
/// @return The list with unique id's of the ColorCorrections
QStringList & getCorrectionIds();
///
/// Returns the pointer to the ColorCorrection with the given id
///
/// @param id The identifier of the ColorCorrection
///
/// @return The ColorCorrection with the given id (or nullptr if it does not exist)
///
ColorCorrection* getCorrection(const QString& id);
///
/// Performs the color transoformation from raw-color to led-color
///
/// @param ledColors The list with raw colors
///
void applyCorrection(std::vector<ColorRgb>& ledColors);
private:
/// List with Correction ids
QStringList _correctionIds;
/// List with unique ColorCorrections
std::vector<ColorCorrection*> _correction;
/// List with a pointer to the ColorCorrection for each individual led
std::vector<ColorCorrection*> _ledCorrections;
// logger instance
Logger * _log;
};