2014-02-19 21:52:37 +01:00
|
|
|
// Qt includes
|
|
|
|
#include <QImage>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
|
|
// hyperion-v4l2 includes
|
|
|
|
#include "ScreenshotHandler.h"
|
|
|
|
|
|
|
|
ScreenshotHandler::ScreenshotHandler(const std::string & filename) :
|
2016-05-26 23:44:27 +02:00
|
|
|
_filename(filename)
|
2014-02-19 21:52:37 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ScreenshotHandler::~ScreenshotHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScreenshotHandler::receiveImage(const Image<ColorRgb> & image)
|
|
|
|
{
|
|
|
|
// store as PNG
|
|
|
|
QImage pngImage((const uint8_t *) image.memptr(), image.width(), image.height(), 3*image.width(), QImage::Format_RGB888);
|
|
|
|
pngImage.save(_filename.c_str());
|
|
|
|
|
|
|
|
// Quit the application after the first image
|
|
|
|
QCoreApplication::quit();
|
|
|
|
}
|