2016-03-09 11:03:20 +01:00
|
|
|
|
|
|
|
// Hyperion-AmLogic includes
|
2016-03-10 21:34:02 +01:00
|
|
|
#include "OsxWrapper.h"
|
2016-03-09 11:03:20 +01:00
|
|
|
|
|
|
|
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) :
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer(this),
|
|
|
|
_grabber(display,grabWidth, grabHeight)
|
2016-03-09 11:03:20 +01:00
|
|
|
{
|
2016-05-26 23:44:27 +02:00
|
|
|
_timer.setSingleShot(false);
|
|
|
|
_timer.setInterval(updateRate_Hz);
|
2016-03-09 11:03:20 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
// Connect capturing to the timeout signal of the timer
|
|
|
|
connect(&_timer, SIGNAL(timeout()), this, SLOT(capture()));
|
2016-03-09 11:03:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & OsxWrapper::getScreenshot()
|
|
|
|
{
|
|
|
|
capture();
|
|
|
|
return _screenshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OsxWrapper::start()
|
|
|
|
{
|
|
|
|
_timer.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OsxWrapper::stop()
|
|
|
|
{
|
|
|
|
_timer.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OsxWrapper::capture()
|
|
|
|
{
|
|
|
|
_grabber.grabFrame(_screenshot);
|
|
|
|
emit sig_screenshot(_screenshot);
|
|
|
|
}
|