| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QRENDERCAPTURE_H |
| 5 | #define QRENDERCAPTURE_H |
| 6 | |
| 7 | #include <Qt3DRender/QFrameGraphNode> |
| 8 | #include <QtGui/QImage> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace Qt3DRender { |
| 13 | |
| 14 | class QRenderCapturePrivate; |
| 15 | class QRenderCaptureReplyPrivate; |
| 16 | |
| 17 | class Q_3DRENDERSHARED_EXPORT QRenderCaptureReply : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | Q_PROPERTY(QImage image READ image CONSTANT) |
| 21 | Q_PROPERTY(int captureId READ captureId CONSTANT) |
| 22 | Q_PROPERTY(bool complete READ isComplete NOTIFY completed) |
| 23 | |
| 24 | public: |
| 25 | |
| 26 | QImage image() const; |
| 27 | Q_DECL_DEPRECATED int captureId() const; |
| 28 | bool isComplete() const; |
| 29 | |
| 30 | Q_INVOKABLE bool saveImage(const QString &fileName) const; |
| 31 | |
| 32 | Q_SIGNALS: |
| 33 | void completed(); |
| 34 | |
| 35 | private: |
| 36 | Q_DECLARE_PRIVATE(QRenderCaptureReply) |
| 37 | |
| 38 | QRenderCaptureReply(QObject *parent = nullptr); |
| 39 | |
| 40 | friend class QRenderCapturePrivate; |
| 41 | }; |
| 42 | |
| 43 | class Q_3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode |
| 44 | { |
| 45 | Q_OBJECT |
| 46 | public: |
| 47 | explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr); |
| 48 | |
| 49 | Qt3DRender::QRenderCaptureReply *requestCapture(int captureId); |
| 50 | Q_REVISION(2, 9) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(); |
| 51 | Q_REVISION(2, 10) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(const QRect &rect); |
| 52 | |
| 53 | private: |
| 54 | Q_DECLARE_PRIVATE(QRenderCapture) |
| 55 | }; |
| 56 | |
| 57 | } // Qt3DRender |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif // QRENDERCAPTURE_H |
| 62 |
