| 1 | // Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QWAYLANDSURFACEGRABBER_H |
| 5 | #define QWAYLANDSURFACEGRABBER_H |
| 6 | |
| 7 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
| 8 | #include <QtCore/QObject> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class QWaylandSurface; |
| 13 | class QWaylandSurfaceGrabberPrivate; |
| 14 | |
| 15 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSurfaceGrabber : public QObject |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | Q_DECLARE_PRIVATE(QWaylandSurfaceGrabber) |
| 19 | public: |
| 20 | enum Error { |
| 21 | InvalidSurface, |
| 22 | NoBufferAttached, |
| 23 | UnknownBufferType, |
| 24 | RendererNotReady, |
| 25 | }; |
| 26 | Q_ENUM(Error) |
| 27 | explicit QWaylandSurfaceGrabber(QWaylandSurface *surface, QObject *parent = nullptr); |
| 28 | |
| 29 | QWaylandSurface *surface() const; |
| 30 | void grab(); |
| 31 | |
| 32 | Q_SIGNALS: |
| 33 | void success(const QImage &image); |
| 34 | void failed(Error error); |
| 35 | }; |
| 36 | |
| 37 | QT_END_NAMESPACE |
| 38 | |
| 39 | #endif // QWAYLANDSURFACEGRABBER_H |
| 40 | |