2014-01-30 13:35:29 +01:00
|
|
|
|
|
|
|
// Hyperion-X11 includes
|
|
|
|
#include "X11Wrapper.h"
|
|
|
|
|
|
|
|
X11Wrapper::X11Wrapper(const unsigned cropHorizontal, const unsigned cropVertical, const unsigned pixelDecimation) :
|
2014-11-21 21:24:33 +01:00
|
|
|
_timer(this),
|
|
|
|
_grabber(cropHorizontal, cropVertical, pixelDecimation)
|
2014-01-30 13:35:29 +01:00
|
|
|
{
|
2014-11-21 21:24:33 +01:00
|
|
|
// Connect capturing to the timeout signal of the timer
|
|
|
|
connect(&_timer, SIGNAL(timeout()), this, SLOT(capture()));
|
2014-01-30 13:35:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Image<ColorRgb> & X11Wrapper::getScreenshot()
|
|
|
|
{
|
2014-11-21 21:24:33 +01:00
|
|
|
const Image<ColorRgb> & screenshot = _grabber.grab();
|
|
|
|
return screenshot;
|
2014-01-30 13:35:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void X11Wrapper::start()
|
|
|
|
{
|
2014-11-21 21:24:33 +01:00
|
|
|
_timer.start(100);
|
2014-01-30 13:35:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void X11Wrapper::stop()
|
|
|
|
{
|
2014-11-21 21:24:33 +01:00
|
|
|
_timer.stop();
|
2014-01-30 13:35:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void X11Wrapper::capture()
|
|
|
|
{
|
2014-11-21 21:24:33 +01:00
|
|
|
const Image<ColorRgb> & screenshot = _grabber.grab();
|
|
|
|
emit sig_screenshot(screenshot);
|
2014-01-30 13:35:29 +01:00
|
|
|
}
|