Integrate color temperature into RGB transformations

This commit is contained in:
LordGrey
2024-05-30 19:11:51 +02:00
parent 07dfce68f6
commit 5897e24316
17 changed files with 177 additions and 654 deletions

View File

@@ -1,18 +0,0 @@
#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,7 +22,6 @@
#include <hyperion/LedString.h>
#include <hyperion/PriorityMuxer.h>
#include <hyperion/ColorAdjustment.h>
#include <hyperion/ColorCorrection.h>
#include <hyperion/ComponentRegister.h>
#if defined(ENABLE_EFFECTENGINE)
@@ -184,30 +183,15 @@ 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)

View File

@@ -26,7 +26,7 @@ public:
*/
void addAdjustment(ColorAdjustment * adjustment);
void setAdjustmentForLed(const QString& id, int startLed, int endLed);
void setAdjustmentForLed(const QString& adjutmentId, int startLed, int endLed);
bool verifyAdjustments() const;
@@ -41,11 +41,11 @@ public:
///
/// Returns the pointer to the ColorAdjustment with the given id
///
/// @param id The identifier of the ColorAdjustment
/// @param adjutmentId The identifier of the ColorAdjustment
///
/// @return The ColorAdjustment with the given id (or nullptr if it does not exist)
///
ColorAdjustment* getAdjustment(const QString& id);
ColorAdjustment* getAdjustment(const QString& adjutmentId);
///
/// Performs the color adjustment from raw-color to led-color

View File

@@ -1,69 +0,0 @@
#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;
};