hyperion.ng
QtGrabber.h
1 #pragma once
2 
3 #include <QObject>
4 
5 // Hyperion-utils includes
6 #include <utils/ColorRgb.h>
7 #include <hyperion/Grabber.h>
8 
9 class QScreen;
10 
14 class QtGrabber : public Grabber
15 {
16 public:
17 
18  QtGrabber(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display);
19 
20  virtual ~QtGrabber();
21 
30  virtual int grabFrame(Image<ColorRgb> & image);
31 
35  virtual void setVideoMode(VideoMode mode);
36 
40  virtual bool setWidthHeight(int width, int height) { return true; };
41 
45  virtual void setPixelDecimation(int pixelDecimation);
46 
54  virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
55 
59  virtual void setDisplayIndex(int index);
60 
61 private slots:
66  void geometryChanged(const QRect &geo);
67 
68 private:
73  bool setupDisplay();
74 
78  int updateScreenDimensions(const bool& force);
79 
83  void freeResources();
84 
85 private:
86 
87  unsigned _display;
88  int _pixelDecimation;
89  unsigned _screenWidth;
90  unsigned _screenHeight;
91  unsigned _src_x;
92  unsigned _src_y;
93  unsigned _src_x_max;
94  unsigned _src_y_max;
95  QScreen* _screen;
96 };
virtual void setVideoMode(VideoMode mode)
Set a new video mode.
Definition: QtGrabber.cpp:175
virtual bool setWidthHeight(int width, int height)
Apply new width/height values, overwrite Grabber.h implementation as qt doesn&#39;t use width/height...
Definition: QtGrabber.h:40
virtual void setDisplayIndex(int index)
Apply display index.
Definition: QtGrabber.cpp:192
The Grabber class is responsible to apply image resizes (with or without ImageResampler) Overwrite th...
Definition: Grabber.h:17
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
Set the crop values.
Definition: QtGrabber.cpp:186
virtual int grabFrame(Image< ColorRgb > &image)
Captures a single snapshot of the display and writes the data to the given image. ...
Definition: QtGrabber.cpp:97
virtual void setPixelDecimation(int pixelDecimation)
Apply new pixelDecimation.
Definition: QtGrabber.cpp:181
The platform capture implementation based on QT API.
Definition: QtGrabber.h:14