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:
T. van der Zwan
2013-12-05 21:01:52 +00:00
35 changed files with 1900 additions and 407 deletions

View 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;
};

View File

@@ -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;

View File

@@ -12,21 +12,21 @@
/// 4) finally, in case of a weird choice of parameters, the output is clamped between [0:1]
///
/// All configuration values are doubles and assume the color value to be between 0 and 1
class ColorTransform
class RgbChannelTransform
{
public:
/// Default constructor
ColorTransform();
RgbChannelTransform();
/// Constructor
/// @param threshold
/// @param gamma
/// @param blacklevel
/// @param whitelevel
ColorTransform(double threshold, double gamma, double blacklevel, double whitelevel);
/// @param threshold The minimum threshold
/// @param gamma The gamma of the gamma-curve correction
/// @param blacklevel The minimum value for the RGB-Channel
/// @param whitelevel The maximum value for the RGB-Channel
RgbChannelTransform(double threshold, double gamma, double blacklevel, double whitelevel);
/// Destructor
~ColorTransform();
~RgbChannelTransform();
/// @return The current threshold value
double getThreshold() const;