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:
@@ -29,6 +29,8 @@ add_library(hyperion-utils
|
||||
${CURRENT_SOURCE_DIR}/RgbChannelTransform.cpp
|
||||
${CURRENT_HEADER_DIR}/RgbChannelCorrection.h
|
||||
${CURRENT_SOURCE_DIR}/RgbChannelCorrection.cpp
|
||||
${CURRENT_HEADER_DIR}/RgbChannelAdjustment.h
|
||||
${CURRENT_SOURCE_DIR}/RgbChannelAdjustment.cpp
|
||||
|
||||
${CURRENT_HEADER_DIR}/jsonschema/JsonFactory.h
|
||||
${CURRENT_HEADER_DIR}/jsonschema/JsonSchemaChecker.h
|
||||
|
107
libsrc/utils/RgbChannelAdjustment.cpp
Normal file
107
libsrc/utils/RgbChannelAdjustment.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
// STL includes
|
||||
#include <cmath>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/RgbChannelAdjustment.h>
|
||||
|
||||
RgbChannelAdjustment::RgbChannelAdjustment() :
|
||||
_adjustR(255),
|
||||
_adjustG(255),
|
||||
_adjustB(255)
|
||||
{
|
||||
initializeMapping();
|
||||
}
|
||||
|
||||
RgbChannelAdjustment::RgbChannelAdjustment(int adjustR, int adjustG, int adjustB) :
|
||||
_adjustR(adjustR),
|
||||
_adjustG(adjustG),
|
||||
_adjustB(adjustB)
|
||||
{
|
||||
initializeMapping();
|
||||
}
|
||||
|
||||
RgbChannelAdjustment::~RgbChannelAdjustment()
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::getadjustmentR() const
|
||||
{
|
||||
return _adjustR;
|
||||
}
|
||||
|
||||
void RgbChannelAdjustment::setadjustmentR(uint8_t adjustR)
|
||||
{
|
||||
_adjustR = adjustR;
|
||||
initializeMapping();
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::getadjustmentG() const
|
||||
{
|
||||
return _adjustG;
|
||||
}
|
||||
|
||||
void RgbChannelAdjustment::setadjustmentG(uint8_t adjustG)
|
||||
{
|
||||
_adjustG = adjustG;
|
||||
initializeMapping();
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::getadjustmentB() const
|
||||
{
|
||||
return _adjustB;
|
||||
}
|
||||
|
||||
void RgbChannelAdjustment::setadjustmentB(uint8_t adjustB)
|
||||
{
|
||||
_adjustB = adjustB;
|
||||
initializeMapping();
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::adjustmentR(uint8_t inputR) const
|
||||
{
|
||||
return _mappingR[inputR];
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::adjustmentG(uint8_t inputG) const
|
||||
{
|
||||
return _mappingG[inputG];
|
||||
}
|
||||
|
||||
uint8_t RgbChannelAdjustment::adjustmentB(uint8_t inputB) const
|
||||
{
|
||||
return _mappingB[inputB];
|
||||
}
|
||||
|
||||
void RgbChannelAdjustment::initializeMapping()
|
||||
{
|
||||
// initialize the mapping
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
int outputR = (i * _adjustR) / 255;
|
||||
if (outputR > 255)
|
||||
{
|
||||
outputR = 255;
|
||||
}
|
||||
_mappingR[i] = outputR;
|
||||
}
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
int outputG = (i * _adjustG) / 255;
|
||||
if (outputG > 255)
|
||||
{
|
||||
outputG = 255;
|
||||
}
|
||||
_mappingG[i] = outputG;
|
||||
}
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
int outputB = (i * _adjustB) / 255;
|
||||
if (outputB > 255)
|
||||
{
|
||||
outputB = 255;
|
||||
}
|
||||
_mappingB[i] = outputB;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user