2013-11-20 09:25:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// STL includes
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// Utils includes
|
|
|
|
#include <utils/ColorRgb.h>
|
|
|
|
|
2013-11-22 11:48:10 +01:00
|
|
|
// Hyperion includes
|
|
|
|
#include <hyperion/ColorTransform.h>
|
2013-11-20 09:25:49 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// The LedColorTransform is responsible for performing color transformation from 'raw' colors
|
|
|
|
/// received as input to colors mapped to match the color-properties of the leds.
|
|
|
|
///
|
|
|
|
class MultiColorTransform
|
|
|
|
{
|
|
|
|
public:
|
2013-11-22 11:48:10 +01:00
|
|
|
MultiColorTransform(const unsigned ledCnt);
|
2013-11-20 09:25:49 +01:00
|
|
|
~MultiColorTransform();
|
|
|
|
|
2013-11-22 11:48:10 +01:00
|
|
|
/**
|
|
|
|
* Adds a new ColorTransform to this MultiColorTransform
|
|
|
|
*
|
|
|
|
* @param transform The new ColorTransform (ownership is transfered)
|
|
|
|
*/
|
|
|
|
void addTransform(ColorTransform * transform);
|
2013-11-20 09:25:49 +01:00
|
|
|
|
|
|
|
void setTransformForLed(const std::string& id, const unsigned startLed, const unsigned endLed);
|
|
|
|
|
2013-11-22 11:48:10 +01:00
|
|
|
bool verifyTransforms() const;
|
|
|
|
|
2013-11-20 09:25:49 +01:00
|
|
|
///
|
|
|
|
/// Returns the identifier of all the unique ColorTransform
|
|
|
|
///
|
|
|
|
/// @return The list with unique id's of the ColorTransforms
|
2013-11-22 11:48:10 +01:00
|
|
|
const std::vector<std::string> & getTransformIds();
|
2013-11-20 09:25:49 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Returns the pointer to the ColorTransform with the given id
|
|
|
|
///
|
|
|
|
/// @param id The identifier of the ColorTransform
|
|
|
|
///
|
|
|
|
/// @return The ColorTransform with the given id (or nullptr if it does not exist)
|
|
|
|
///
|
|
|
|
ColorTransform* getTransform(const std::string& id);
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Performs the color transoformation from raw-color to led-color
|
|
|
|
///
|
2016-07-01 23:20:41 +02:00
|
|
|
/// @param ledColors The list with raw colors
|
2013-11-20 09:25:49 +01:00
|
|
|
///
|
2016-07-01 23:20:41 +02:00
|
|
|
void applyTransform(std::vector<ColorRgb>& ledColors);
|
2013-11-20 09:25:49 +01:00
|
|
|
|
|
|
|
private:
|
2013-11-22 11:48:10 +01:00
|
|
|
/// List with transform ids
|
|
|
|
std::vector<std::string> _transformIds;
|
|
|
|
|
2013-11-20 09:25:49 +01:00
|
|
|
/// List with unique ColorTransforms
|
|
|
|
std::vector<ColorTransform*> _transform;
|
|
|
|
|
|
|
|
/// List with a pointer to the ColorTransform for each individual led
|
|
|
|
std::vector<ColorTransform*> _ledTransforms;
|
|
|
|
};
|