mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fa7a5b6b56
* Update FindWindowsSDK.cmake * cmake support libcec without version * Ensure Light-Ids are strings * Fix type - do not have dbus as requried * Fixing #1544 * Cleanup * CleanupFix #1551 * Consistently return instance number with JSON replies (#1504) * hyperion-remote- Fix extracting reply for configGet request * Qt 6.6 - Fix iterator finds * Fix test_image2ledsmap * Ensure window.currentHyperionInstanceName is set, cleanup system/log clipboard report * Address protobuf cmake warning * Update License * Update ChangeLog * Address CodeQL and clang findings
42 lines
984 B
C++
42 lines
984 B
C++
|
|
// Utils includes
|
|
#include <utils/Image.h>
|
|
#include <utils/jsonschema/QJsonFactory.h>
|
|
|
|
// Hyperion includes
|
|
#include <utils/hyperion.h>
|
|
#include <hyperion/ImageToLedsMap.h>
|
|
|
|
int main()
|
|
{
|
|
const QString schemaFile = ":/hyperion-schema";
|
|
const QString configFile = ":/hyperion_default.config";
|
|
|
|
|
|
QJsonObject config;
|
|
if (QJsonFactory::load(schemaFile, configFile, config) < 0)
|
|
{
|
|
std::cerr << "UNABLE TO LOAD CONFIGURATION" << std::endl;
|
|
return -1;
|
|
}
|
|
|
|
const LedString ledString = hyperion::createLedString(config["leds"].toArray(), hyperion::createColorOrder(config["device"].toObject()));
|
|
|
|
const ColorRgb testColor = {64, 123, 12};
|
|
|
|
Image<ColorRgb> image(64, 64, testColor);
|
|
hyperion::ImageToLedsMap map(64, 64, 0, 0, ledString.leds());
|
|
|
|
std::vector<ColorRgb> ledColors(ledString.leds().size());
|
|
map.getMeanLedColor(image, ledColors);
|
|
|
|
std::cout << "[";
|
|
for (const ColorRgb & color : ledColors)
|
|
{
|
|
std::cout << color;
|
|
}
|
|
std::cout << "]" << std::endl;
|
|
|
|
return 0;
|
|
}
|