1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or later as published by the Free
28** Software Foundation and appearing in the file LICENSE.GPL included in
29** the packaging of this file. Please review the following information to
30** ensure the GNU General Public License version 2.0 requirements will be
31** met: http://www.gnu.org/licenses/gpl-2.0.html.
32**
33** $QT_END_LICENSE$
34**
35****************************************************************************/
36
37#ifndef QRENDERCAPTURE_H
38#define QRENDERCAPTURE_H
39
40#include <Qt3DRender/QFrameGraphNode>
41#include <QtGui/QImage>
42
43QT_BEGIN_NAMESPACE
44
45namespace Qt3DRender {
46
47class QRenderCapturePrivate;
48class QRenderCaptureReplyPrivate;
49
50class Q_3DRENDERSHARED_EXPORT QRenderCaptureReply : public QObject
51{
52 Q_OBJECT
53 Q_PROPERTY(QImage image READ image CONSTANT)
54 Q_PROPERTY(int captureId READ captureId CONSTANT)
55 Q_PROPERTY(bool complete READ isComplete NOTIFY completed)
56
57public:
58
59 QImage image() const;
60 Q_DECL_DEPRECATED int captureId() const;
61 bool isComplete() const;
62
63 Q_INVOKABLE bool saveImage(const QString &fileName) const;
64#if QT_DEPRECATED_SINCE(5, 9)
65 // ### Qt 6: remove this
66 Q_DECL_DEPRECATED_X("Use saveImage instead") Q_INVOKABLE void saveToFile(const QString &fileName) const;
67#endif
68
69Q_SIGNALS:
70 Q_DECL_DEPRECATED_X("Use completed instead") void completeChanged(bool isComplete);
71 void completed();
72
73private:
74 Q_DECLARE_PRIVATE(QRenderCaptureReply)
75
76 QRenderCaptureReply(QObject *parent = nullptr);
77
78 friend class QRenderCapturePrivate;
79};
80
81class Q_3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode
82{
83 Q_OBJECT
84public:
85 explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr);
86
87 Q_INVOKABLE Q_DECL_DEPRECATED_X("Use the overload with no id parameter")
88 Qt3DRender::QRenderCaptureReply *requestCapture(int captureId);
89 Q_REVISION(9) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture();
90 Q_REVISION(10) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(const QRect &rect);
91
92protected:
93 void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override;
94
95private:
96 Q_DECLARE_PRIVATE(QRenderCapture)
97 Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override;
98};
99
100} // Qt3DRender
101
102QT_END_NAMESPACE
103
104#endif // QRENDERCAPTURE_H
105

source code of qt3d/src/render/framegraph/qrendercapture.h