mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'master' into add_effect_engine
Conflicts: include/hyperion/Hyperion.h libsrc/hyperion/Hyperion.cpp libsrc/jsonserver/JsonClientConnection.cpp Former-commit-id: 53467c63b97c7dc370f04357588f7cf1ad0e3ada
This commit is contained in:
26
include/hyperion/ColorTransform.h
Normal file
26
include/hyperion/ColorTransform.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
// STL includes
|
||||
#include <string>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/RgbChannelTransform.h>
|
||||
#include <utils/HsvTransform.h>
|
||||
|
||||
class ColorTransform
|
||||
{
|
||||
public:
|
||||
|
||||
/// Unique identifier for this color transform
|
||||
std::string _id;
|
||||
|
||||
/// The RED-Channel (RGB) transform
|
||||
RgbChannelTransform _rgbRedTransform;
|
||||
/// The GREEN-Channel (RGB) transform
|
||||
RgbChannelTransform _rgbGreenTransform;
|
||||
/// The BLUE-Channel (RGB) transform
|
||||
RgbChannelTransform _rgbBlueTransform;
|
||||
|
||||
/// The HSV Transform for applying Saturation and Value transforms
|
||||
HsvTransform _hsvTransform;
|
||||
};
|
@@ -19,9 +19,11 @@
|
||||
#include <effectengine/EffectDefinition.h>
|
||||
|
||||
// Forward class declaration
|
||||
class HsvTransform;
|
||||
class ColorTransform;
|
||||
class EffectEngine;
|
||||
class HsvTransform;
|
||||
class RgbChannelTransform;
|
||||
class MultiColorTransform;
|
||||
|
||||
///
|
||||
/// The main class of Hyperion. This gives other 'users' access to the attached LedDevice through
|
||||
@@ -37,7 +39,7 @@ public:
|
||||
///
|
||||
/// RGB-Color channel enumeration
|
||||
///
|
||||
enum Color
|
||||
enum RgbChannel
|
||||
{
|
||||
RED, GREEN, BLUE, INVALID
|
||||
};
|
||||
@@ -73,18 +75,6 @@ public:
|
||||
///
|
||||
unsigned getLedCount() const;
|
||||
|
||||
///
|
||||
/// Returns the value of a specific color transform
|
||||
///
|
||||
/// @param[in] transform The type of transform
|
||||
/// @param[in] color The color channel to which the transform applies (only applicable for
|
||||
/// Transform::THRESHOLD, Transform::GAMMA, Transform::BLACKLEVEL,
|
||||
/// Transform::WHITELEVEL)
|
||||
///
|
||||
/// @return The value of the specified color transform
|
||||
///
|
||||
double getTransform(Transform transform, Color color) const;
|
||||
|
||||
///
|
||||
/// Returns a list of active priorities
|
||||
///
|
||||
@@ -127,15 +117,19 @@ public slots:
|
||||
void setColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
||||
|
||||
///
|
||||
/// Sets/Updates a part of the color transformation.
|
||||
/// Returns the list with unique transform identifiers
|
||||
/// @return The list with transform identifiers
|
||||
///
|
||||
/// @param[in] transform The type of transform to configure
|
||||
/// @param[in] color The color channel to which the transform applies (only applicable for
|
||||
/// Transform::THRESHOLD, Transform::GAMMA, Transform::BLACKLEVEL,
|
||||
/// Transform::WHITELEVEL)
|
||||
/// @param[in] value The new value for the given transform
|
||||
const std::vector<std::string> & getTransformIds() const;
|
||||
|
||||
///
|
||||
void setTransform(Transform transform, Color color, double value);
|
||||
/// Returns the ColorTransform with the given identifier
|
||||
/// @return The transform with the given identifier (or nullptr if the identifier does not exist)
|
||||
///
|
||||
ColorTransform * getTransform(const std::string& id);
|
||||
|
||||
/// Tell Hyperion that the transforms have changed and the leds need to be updated
|
||||
void transformsUpdated();
|
||||
|
||||
///
|
||||
/// Clears the given priority channel. This will switch the led-colors to the colors of the next
|
||||
@@ -174,8 +168,12 @@ public:
|
||||
static LedDevice * createDevice(const Json::Value & deviceConfig);
|
||||
static ColorOrder createColorOrder(const Json::Value & deviceConfig);
|
||||
static LedString createLedString(const Json::Value & ledsConfig);
|
||||
|
||||
static MultiColorTransform * createLedColorsTransform(const unsigned ledCnt, const Json::Value & colorTransformConfig);
|
||||
static ColorTransform * createColorTransform(const Json::Value & transformConfig);
|
||||
static HsvTransform * createHsvTransform(const Json::Value & hsvConfig);
|
||||
static ColorTransform * createColorTransform(const Json::Value & colorConfig);
|
||||
static RgbChannelTransform * createRgbChannelTransform(const Json::Value& colorConfig);
|
||||
|
||||
static LedDevice * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice);
|
||||
|
||||
signals:
|
||||
@@ -195,28 +193,14 @@ private slots:
|
||||
void update();
|
||||
|
||||
private:
|
||||
///
|
||||
/// Applies all color transmforms to the given list of colors. The transformation is performed
|
||||
/// in place.
|
||||
///
|
||||
/// @param colors The colors to be transformed
|
||||
///
|
||||
void applyTransform(std::vector<ColorRgb>& colors) const;
|
||||
|
||||
/// The specifiation of the led frame construction and picture integration
|
||||
LedString _ledString;
|
||||
|
||||
/// The priority muxer
|
||||
PriorityMuxer _muxer;
|
||||
|
||||
/// The HSV Transform for applying Saturation and Value transforms
|
||||
HsvTransform * _hsvTransform;
|
||||
/// The RED-Channel (RGB) transform
|
||||
ColorTransform * _redTransform;
|
||||
/// The GREEN-Channel (RGB) transform
|
||||
ColorTransform * _greenTransform;
|
||||
/// The BLUE-Channel (RGB) transform
|
||||
ColorTransform * _blueTransform;
|
||||
/// The transformation from raw colors to led colors
|
||||
MultiColorTransform * _raw2ledTransform;
|
||||
|
||||
/// Value with the desired color byte order
|
||||
ColorOrder _colorOrder;
|
||||
|
Reference in New Issue
Block a user