2015-01-24 23:42:22 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// OSX includes
|
2017-08-12 07:55:32 +02:00
|
|
|
#ifdef __APPLE__
|
2015-01-24 23:42:22 +01:00
|
|
|
#include <CoreGraphics/CoreGraphics.h>
|
2017-08-12 07:55:32 +02:00
|
|
|
#else
|
|
|
|
#include <grabber/OsxFrameGrabberMock.h>
|
|
|
|
#endif
|
2015-01-24 23:42:22 +01:00
|
|
|
|
|
|
|
// Utils includes
|
|
|
|
#include <utils/ColorRgb.h>
|
2017-08-04 23:08:15 +02:00
|
|
|
#include <hyperion/Grabber.h>
|
2015-01-24 23:42:22 +01:00
|
|
|
|
|
|
|
///
|
2018-12-27 23:11:32 +01:00
|
|
|
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
|
2015-01-24 23:42:22 +01:00
|
|
|
///
|
2017-08-04 23:08:15 +02:00
|
|
|
class OsxFrameGrabber : public Grabber
|
2015-01-24 23:42:22 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
/// Construct a OsxFrameGrabber that will capture snapshots with specified dimensions.
|
|
|
|
///
|
|
|
|
/// @param[in] display The index of the display to capture
|
|
|
|
/// @param[in] width The width of the captured screenshot
|
|
|
|
/// @param[in] height The heigth of the captured screenshot
|
|
|
|
///
|
|
|
|
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
|
2020-07-12 09:19:59 +02:00
|
|
|
~OsxFrameGrabber() override;
|
2015-01-24 23:42:22 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Captures a single snapshot of the display and writes the data to the given image. The
|
|
|
|
/// provided image should have the same dimensions as the configured values (_width and
|
|
|
|
/// _height)
|
|
|
|
///
|
|
|
|
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
|
|
|
/// height)
|
|
|
|
///
|
2017-08-12 07:55:32 +02:00
|
|
|
int grabFrame(Image<ColorRgb> & image);
|
2015-01-24 23:42:22 +01:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
|
|
|
/// @brief Overwrite Grabber.h implementation
|
|
|
|
///
|
|
|
|
virtual void setDisplayIndex(int index);
|
|
|
|
|
|
|
|
private:
|
2015-01-24 23:42:22 +01:00
|
|
|
/// display
|
2018-12-27 23:11:32 +01:00
|
|
|
unsigned _screenIndex;
|
|
|
|
|
2015-01-24 23:42:22 +01:00
|
|
|
/// Reference to the captured diaplay
|
|
|
|
CGDirectDisplayID _display;
|
|
|
|
};
|