Debian Codegraph @

tests/manual/rendercapture-qml-fbo/main.qml

raw
1 // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.2
5 import QtQuick.Layouts 1.3
6 import QtQuick.Controls 2.0
7 import Qt3D.Render 2.1
8 import QtQuick.Scene3D 2.0
9
10 Item {
11
12 width: 1250
13 height: 700
14
15 RowLayout {
16 anchors.fill: parent
17 anchors.margins: 10
18
19 Rectangle {
20 id: background
21 width: 600
22 height: 600
23
24 color: "blue"
25
26 Scene3D {
27 id: scene3d
28 anchors.fill: parent
29 multisample: msacheckbox.checked
30
31 aspects: ["input", "logic"]
32
33 CaptureScene {
34 id: scene
35 }
36 }
37 }
38
39 ColumnLayout {
40
41 Button {
42 id: button
43 text: "Render Capture"
44
45 property var reply
46 property bool continuous : checkbox.checked
47 property int cid: 1
48
49 function doRenderCapture()
50 {
51 reply = scene.requestRenderCapture()
52 reply.completed.connect(onRenderCaptureComplete)
53 }
54
55 function onRenderCaptureComplete()
56 {
57 _renderCaptureProvider.updateImage(reply)
58 image.source = "image://rendercapture/" + cid
59 reply.saveImage("capture.png")
60 reply.destroy()
61 cid++
62 if (continuous === true)
63 doRenderCapture()
64 }
65
66 onClicked: doRenderCapture()
67 }
68 RowLayout {
69 CheckBox {
70 id: checkbox
71 text: "continuous"
72 }
73 CheckBox {
74 id: msacheckbox
75 text: "multisample"
76 }
77 }
78 Image {
79 id: image
80 cache: false
81 source: "image://rendercapture/0"
82 Layout.maximumWidth: 600
83 Layout.minimumWidth: 600
84 Layout.maximumHeight: 600
85 Layout.minimumHeight: 600
86 }
87 }
88 }
89 }