mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add color adjustment to all RBG channels
* Channel adjustment config * Create RgbChannelAdjustment.h * Delete RgbChannelAdjustment.h * Create RgbChannelAdjustment.cpp * Create RgbChannelAdjustment.h * Delete RgbChannelAdjustment.cpp * Create ColorAdjustment.cpp * Delete RgbChannelAdjustment.h * Create ColorAdjustment.h * Update ColorAdjustment.h * Update ColorAdjustment.h * Update ColorAdjustment.h * Update ColorAdjustment.cpp * Update Hyperion.cpp * Update Hyperion.cpp * Update Hyperion.cpp * Update Hyperion.h * Create RgbChannelAdjustment.cpp * Create RgbChannelAdjustment.h * Create ColorAdjustment.h * Create MultiColorAdjustment.h * Update MultiColorAdjustment.h * Create MultiColorAdjustment.cpp * Delete ColorAdjustment.cpp * Delete ColorAdjustment.h * Update RgbChannelAdjustment.cpp * Update Hyperion.cpp * Update Hyperion.h * Update Hyperion.cpp * Bug fixes * Update hyperion.config.json * Add color adjustment to json server and client and adapt hyperion-remote * Change the color modification order * Minor bug fix * Create calibration Images folder * Create calibration Gamma folder * Create calibration RGB folder * Added files via upload * Delete .gitkeep * Delete .gitkeep * Added files via upload * Delete .gitkeep * Update color effect order and don't correct twice * Uploaded gradient images Former-commit-id: 8ab465e59834f12a21709a6f4546bd6808a2a495
This commit is contained in:
22
include/hyperion/ColorAdjustment.h
Normal file
22
include/hyperion/ColorAdjustment.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// STL includes
|
||||
#include <string>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/RgbChannelAdjustment.h>
|
||||
|
||||
class ColorAdjustment
|
||||
{
|
||||
public:
|
||||
|
||||
/// Unique identifier for this color transform
|
||||
std::string _id;
|
||||
|
||||
/// The RED-Channel (RGB) adjustment
|
||||
RgbChannelAdjustment _rgbRedAdjustment;
|
||||
/// The GREEN-Channel (RGB) transform
|
||||
RgbChannelAdjustment _rgbGreenAdjustment;
|
||||
/// The BLUE-Channel (RGB) transform
|
||||
RgbChannelAdjustment _rgbBlueAdjustment;
|
||||
};
|
@@ -15,6 +15,7 @@
|
||||
#include <hyperion/PriorityMuxer.h>
|
||||
#include <hyperion/ColorTransform.h>
|
||||
#include <hyperion/ColorCorrection.h>
|
||||
#include <hyperion/ColorAdjustment.h>
|
||||
#include <hyperion/MessageForwarder.h>
|
||||
|
||||
// Effect engine includes
|
||||
@@ -28,10 +29,11 @@ class HsvTransform;
|
||||
class HslTransform;
|
||||
class RgbChannelTransform;
|
||||
class RgbChannelCorrection;
|
||||
class RgbChannelAdjustment;
|
||||
class MultiColorTransform;
|
||||
class MultiColorCorrection;
|
||||
class MultiColorTemperature;
|
||||
|
||||
class MultiColorAdjustment;
|
||||
///
|
||||
/// The main class of Hyperion. This gives other 'users' access to the attached LedDevice through
|
||||
/// the priority muxer.
|
||||
@@ -135,6 +137,12 @@ public slots:
|
||||
///
|
||||
const std::vector<std::string> & getTemperatureIds() const;
|
||||
|
||||
///
|
||||
/// Returns the list with unique adjustment identifiers
|
||||
/// @return The list with adjustment identifiers
|
||||
///
|
||||
const std::vector<std::string> & getAdjustmentIds() const;
|
||||
|
||||
///
|
||||
/// Returns the ColorTransform with the given identifier
|
||||
/// @return The transform with the given identifier (or nullptr if the identifier does not exist)
|
||||
@@ -153,6 +161,12 @@ public slots:
|
||||
///
|
||||
ColorCorrection * getTemperature(const std::string& id);
|
||||
|
||||
///
|
||||
/// 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 std::string& id);
|
||||
|
||||
///
|
||||
/// Returns MessageForwarder Object
|
||||
/// @return instance of message forwarder object
|
||||
@@ -168,6 +182,9 @@ public slots:
|
||||
/// Tell Hyperion that the corrections have changed and the leds need to be updated
|
||||
void temperaturesUpdated();
|
||||
|
||||
/// Tell Hyperion that the corrections have changed and the leds need to be updated
|
||||
void adjustmentsUpdated();
|
||||
|
||||
///
|
||||
/// 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)
|
||||
@@ -208,16 +225,19 @@ public:
|
||||
static MultiColorTransform * createLedColorsTransform(const unsigned ledCnt, const Json::Value & colorTransformConfig);
|
||||
static MultiColorCorrection * createLedColorsCorrection(const unsigned ledCnt, const Json::Value & colorCorrectionConfig);
|
||||
static MultiColorCorrection * createLedColorsTemperature(const unsigned ledCnt, const Json::Value & colorTemperatureConfig);
|
||||
static MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const Json::Value & colorAdjustmentConfig);
|
||||
static ColorTransform * createColorTransform(const Json::Value & transformConfig);
|
||||
static ColorCorrection * createColorCorrection(const Json::Value & correctionConfig);
|
||||
static ColorAdjustment * createColorAdjustment(const Json::Value & adjustmentConfig);
|
||||
static HsvTransform * createHsvTransform(const Json::Value & hsvConfig);
|
||||
static HslTransform * createHslTransform(const Json::Value & hslConfig);
|
||||
static RgbChannelTransform * createRgbChannelTransform(const Json::Value& colorConfig);
|
||||
static RgbChannelCorrection * createRgbChannelCorrection(const Json::Value& colorConfig);
|
||||
static RgbChannelAdjustment * createRgbChannelAdjustment(const Json::Value& colorConfig, const RgbChannel color);
|
||||
|
||||
static LedDevice * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice);
|
||||
static MessageForwarder * createMessageForwarder(const Json::Value & forwarderConfig);
|
||||
|
||||
|
||||
signals:
|
||||
/// Signal which is emitted when a priority channel is actively cleared
|
||||
/// This signal will not be emitted when a priority channel time out
|
||||
@@ -241,15 +261,18 @@ private:
|
||||
/// The priority muxer
|
||||
PriorityMuxer _muxer;
|
||||
|
||||
/// The transformation from corrected colors to led colors
|
||||
/// The transformation from raw colors to led colors
|
||||
MultiColorTransform * _raw2ledTransform;
|
||||
|
||||
/// The correction from raw colors to led colors
|
||||
MultiColorCorrection * _raw2ledCorrection;
|
||||
|
||||
/// The temperature from corrected colors to led colors
|
||||
/// The temperature from raw colors to led colors
|
||||
MultiColorCorrection * _raw2ledTemperature;
|
||||
|
||||
/// The adjustment from raw colors to led colors
|
||||
MultiColorAdjustment * _raw2ledAdjustment;
|
||||
|
||||
/// The actual LedDevice
|
||||
LedDevice * _device;
|
||||
|
||||
|
66
include/utils/RgbChannelAdjustment.h
Normal file
66
include/utils/RgbChannelAdjustment.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
// STL includes
|
||||
#include <cstdint>
|
||||
|
||||
/// Correction for a single color byte value
|
||||
/// All configuration values are unsigned int and assume the color value to be between 0 and 255
|
||||
class RgbChannelAdjustment
|
||||
{
|
||||
public:
|
||||
/// Default constructor
|
||||
RgbChannelAdjustment();
|
||||
|
||||
/// Constructor
|
||||
/// @param adjustR
|
||||
/// @param adjustG
|
||||
/// @param adjustB
|
||||
|
||||
RgbChannelAdjustment(int adjustR, int adjustG, int adjustB);
|
||||
|
||||
/// Destructor
|
||||
~RgbChannelAdjustment();
|
||||
|
||||
/// @return The current adjustR value
|
||||
uint8_t getadjustmentR() const;
|
||||
|
||||
/// @param threshold New adjustR value
|
||||
void setadjustmentR(uint8_t adjustR);
|
||||
|
||||
/// @return The current adjustG value
|
||||
uint8_t getadjustmentG() const;
|
||||
|
||||
/// @param gamma New adjustG value
|
||||
void setadjustmentG(uint8_t adjustG);
|
||||
|
||||
/// @return The current adjustB value
|
||||
uint8_t getadjustmentB() const;
|
||||
|
||||
/// @param blacklevel New adjustB value
|
||||
void setadjustmentB(uint8_t adjustB);
|
||||
|
||||
/// Transform the given array value
|
||||
/// @param input The input color bytes
|
||||
/// @return The corrected byte value
|
||||
uint8_t adjustmentR(uint8_t inputR) const;
|
||||
uint8_t adjustmentG(uint8_t inputG) const;
|
||||
uint8_t adjustmentB(uint8_t inputB) const;
|
||||
|
||||
|
||||
private:
|
||||
/// (re)-initilize the color mapping
|
||||
void initializeMapping();
|
||||
|
||||
private:
|
||||
/// The adjustment of R channel
|
||||
int _adjustR;
|
||||
/// The adjustment of G channel
|
||||
int _adjustG;
|
||||
/// The adjustment of B channel
|
||||
int _adjustB;
|
||||
|
||||
/// The mapping from input color to output color
|
||||
int _mappingR[256];
|
||||
int _mappingG[256];
|
||||
int _mappingB[256];
|
||||
};
|
Reference in New Issue
Block a user