2016-04-02 00:04:11 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// STL includes
|
|
|
|
#include <cstdint>
|
2017-01-10 19:58:41 +01:00
|
|
|
#include <QString>
|
|
|
|
#include <utils/Logger.h>
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// 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
|
2017-01-10 19:58:41 +01:00
|
|
|
RgbChannelAdjustment(QString channelName="");
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// Constructor
|
|
|
|
/// @param adjustR
|
|
|
|
/// @param adjustG
|
|
|
|
/// @param adjustB
|
2017-01-10 19:58:41 +01:00
|
|
|
RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB, QString channelName="");
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// Destructor
|
|
|
|
~RgbChannelAdjustment();
|
|
|
|
|
2016-07-02 14:00:48 +02:00
|
|
|
/// setAdjustment RGB
|
|
|
|
/// @param adjustR
|
|
|
|
/// @param adjustG
|
|
|
|
/// @param adjustB
|
|
|
|
void setAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB);
|
2016-04-02 00:04:11 +02:00
|
|
|
|
2016-07-04 00:43:41 +02:00
|
|
|
/// @return The current adjustR value
|
|
|
|
uint8_t getAdjustmentR() const;
|
|
|
|
|
2016-04-02 00:04:11 +02:00
|
|
|
/// @param threshold New adjustR value
|
2016-07-02 14:00:48 +02:00
|
|
|
void setAdjustmentR(uint8_t adjustR);
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// @return The current adjustG value
|
2016-07-02 14:00:48 +02:00
|
|
|
uint8_t getAdjustmentG() const;
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// @param gamma New adjustG value
|
2016-07-02 14:00:48 +02:00
|
|
|
void setAdjustmentG(uint8_t adjustG);
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// @return The current adjustB value
|
2016-07-02 14:00:48 +02:00
|
|
|
uint8_t getAdjustmentB() const;
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// @param blacklevel New adjustB value
|
2016-07-02 14:00:48 +02:00
|
|
|
void setAdjustmentB(uint8_t adjustB);
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// Transform the given array value
|
|
|
|
/// @param input The input color bytes
|
|
|
|
/// @return The corrected byte value
|
2016-12-29 17:02:37 +01:00
|
|
|
uint8_t getAdjustmentR(uint8_t inputR) const;
|
|
|
|
uint8_t getAdjustmentG(uint8_t inputG) const;
|
|
|
|
uint8_t getAdjustmentB(uint8_t inputB) const;
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
2016-07-02 14:00:48 +02:00
|
|
|
/// color channels
|
|
|
|
enum ColorChannel { RED=0,GREEN=1, BLUE=2 };
|
|
|
|
|
2016-04-02 00:04:11 +02:00
|
|
|
/// (re)-initilize the color mapping
|
|
|
|
void initializeMapping();
|
2016-07-02 14:00:48 +02:00
|
|
|
|
|
|
|
/// The adjustment of RGB channel
|
|
|
|
uint8_t _adjust[3];
|
2016-04-02 00:04:11 +02:00
|
|
|
|
|
|
|
/// The mapping from input color to output color
|
2016-07-02 14:00:48 +02:00
|
|
|
uint8_t _mapping[3][256];
|
2017-01-10 19:58:41 +01:00
|
|
|
|
|
|
|
/// Name of this channel, usefull for debug messages
|
|
|
|
QString _channelName;
|
|
|
|
|
|
|
|
/// Logger instance
|
|
|
|
Logger * _log;
|
2016-04-02 00:04:11 +02:00
|
|
|
};
|