hyperion.ng/include/utils/RgbChannelAdjustment.h
LordGrey efc2046ab5
Various Cleanups (#1075)
* LedDevice - Address clang findings

* Fix Windows Warnings

* Ensure newInput is initialised

* Clean-up unused elements for Plaform Capture

* Fix initialization problem and spellings

* Address clang findings and spelling corrections

* LedDevice clean-ups

* Cleanups

* Align that getLedCount is int

* Have "display" as default for Grabbers

* Fix config during start-up for missing elements

* Framegrabber Clean-up - Remove non supported grabbers from selection, filter valid options

* Typo

* Framegrabber.json - Fix property numbering

* Preselect active Grabbertype

* Sort Grabbernames

* Align options with selected element

* Fix deletion of pointer to incomplete type 'BonjourBrowserWrapper'

* Address macOS compile warnings

* Have default layout = 1 LED only to avoid errors as in #673

* Address lgtm findings

* Address finding that params passed to LedDevice discovery were not considered

* Cleanups after merging with latest master

* Update Changelog

* Address lgtm findings

* Fix comment

* Test Fix

* Fix Python Warning

* Handle Dummy Device assignment correctly

* Address delete called on non-final 'commandline::Option' that has virtual functions but non-virtual destructor

* Correct that QTimer.start accepts only int

* Have Release Python GIL & reset threat state chnage downward compatible

* Correct format specifier

* LedDevice - add assertions

* Readonly DB - Fix merge issue

* Smoothing - Fix wrong defaults

* LedDevice - correct assertion

* Show smoothing config set# in debug and related values.

* Suppress error on windows, if default file is "/dev/null"

* CMAKE - Allow to define QT_BASE_DIR dynamically via environment-variable

* Ignore Visual Studio specific files

Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-11-14 17:58:56 +01:00

78 lines
1.8 KiB
C++

#pragma once
// STL includes
#include <cstdint>
#include <QString>
#include <utils/Logger.h>
/// 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(QString channelName="");
/// Constructor
/// @param adjustR
/// @param adjustG
/// @param adjustB
RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB, QString channelName="");
///
/// Transform the given array value
///
/// @param input The input color bytes
/// @param brightness The current brightness value
/// @param red The red color component
/// @param green The green color component
/// @param blue The blue color component
///
/// @note The values are updated in place.
///
void apply(uint8_t input, uint8_t brightness, uint8_t & red, uint8_t & green, uint8_t & blue);
///
/// setAdjustment RGB
///
/// @param adjustR
/// @param adjustG
/// @param adjustB
///
void setAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB);
/// @return The current adjustR value
uint8_t getAdjustmentR() const;
/// @return The current adjustG value
uint8_t getAdjustmentG() const;
/// @return The current adjustB value
uint8_t getAdjustmentB() const;
private:
/// color channels
enum ColorChannel { RED=0, GREEN=1, BLUE=2 };
/// reset init of color mapping
void resetInitialized();
/// The adjustment of RGB channel
uint8_t _adjust[3];
/// The mapping from input color to output color
uint8_t _mapping[3][256];
/// Name of this channel, usefull for debug messages
QString _channelName;
/// Logger instance
Logger * _log;
/// bitfield to determine white value is alreade initialized
bool _initialized[256];
/// current brightness value
uint8_t _brightness;
};