mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Commits from @MartB and more ...
- Commit: 1d9165f403
- New default QT capture implementation
- UploadHandler added to Effects Configurator to allow uploading GIF files
- Docker compile script and instruction
- Travis Fix
This commit is contained in:
@@ -39,7 +39,7 @@ public:
|
||||
virtual bool setWidthHeight(int width, int height);
|
||||
|
||||
///
|
||||
/// @brief Apply new pixelDecimation (used from x11)
|
||||
/// @brief Apply new pixelDecimation (used from x11 and qt)
|
||||
///
|
||||
virtual void setPixelDecimation(int pixelDecimation) {};
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
virtual void setDeviceVideoStandard(QString device, VideoStandard videoStandard) {};
|
||||
|
||||
///
|
||||
/// @brief Apply display index (used from x11)
|
||||
/// @brief Apply display index (used from qt)
|
||||
///
|
||||
virtual void setDisplayIndex(int index) {};
|
||||
|
||||
|
@@ -360,8 +360,14 @@ public slots:
|
||||
/// @param args arguments of the effect script
|
||||
/// @param priority The priority channel of the effect
|
||||
/// @param timeout The timeout of the effect (after the timout, the effect will be cleared)
|
||||
int setEffect(const QString & effectName, const QJsonObject & args, int priority,
|
||||
int timeout = -1, const QString & pythonScript = "", const QString & origin="System");
|
||||
int setEffect(const QString &effectName
|
||||
, const QJsonObject &args
|
||||
, int priority
|
||||
, int timeout = -1
|
||||
, const QString &pythonScript = ""
|
||||
, const QString &origin="System"
|
||||
, const QString &imageData = ""
|
||||
);
|
||||
|
||||
/// sets the methode how image is maped to leds at ImageProcessor
|
||||
void setLedMappingType(const int& mappingType);
|
||||
|
@@ -168,7 +168,9 @@ namespace hyperion
|
||||
template <typename Pixel_T>
|
||||
ColorRgb calcMeanColor(const Image<Pixel_T> & image, const std::vector<unsigned> & colors) const
|
||||
{
|
||||
if (colors.size() == 0)
|
||||
const auto colorVecSize = colors.size();
|
||||
|
||||
if (colorVecSize == 0)
|
||||
{
|
||||
return ColorRgb::BLACK;
|
||||
}
|
||||
@@ -177,18 +179,20 @@ namespace hyperion
|
||||
uint_fast16_t cummRed = 0;
|
||||
uint_fast16_t cummGreen = 0;
|
||||
uint_fast16_t cummBlue = 0;
|
||||
const auto& imgData = image.memptr();
|
||||
|
||||
for (const unsigned colorOffset : colors)
|
||||
{
|
||||
const Pixel_T& pixel = image.memptr()[colorOffset];
|
||||
const auto& pixel = imgData[colorOffset];
|
||||
cummRed += pixel.red;
|
||||
cummGreen += pixel.green;
|
||||
cummBlue += pixel.blue;
|
||||
}
|
||||
|
||||
// Compute the average of each color channel
|
||||
const uint8_t avgRed = uint8_t(cummRed/colors.size());
|
||||
const uint8_t avgGreen = uint8_t(cummGreen/colors.size());
|
||||
const uint8_t avgBlue = uint8_t(cummBlue/colors.size());
|
||||
const uint8_t avgRed = uint8_t(cummRed/colorVecSize);
|
||||
const uint8_t avgGreen = uint8_t(cummGreen/colorVecSize);
|
||||
const uint8_t avgBlue = uint8_t(cummBlue/colorVecSize);
|
||||
|
||||
// Return the computed color
|
||||
return {avgRed, avgGreen, avgBlue};
|
||||
@@ -211,9 +215,11 @@ namespace hyperion
|
||||
uint_fast16_t cummBlue = 0;
|
||||
const unsigned imageSize = image.width() * image.height();
|
||||
|
||||
const auto& imgData = image.memptr();
|
||||
|
||||
for (unsigned idx=0; idx<imageSize; idx++)
|
||||
{
|
||||
const Pixel_T& pixel = image.memptr()[idx];
|
||||
const auto& pixel = imgData[idx];
|
||||
cummRed += pixel.red;
|
||||
cummGreen += pixel.green;
|
||||
cummBlue += pixel.blue;
|
||||
|
Reference in New Issue
Block a user