Debian Codegraph @

tests/manual/qmlappshadermacro/main.qml

raw
1 // Copyright (C) 2020 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.15
5
6 Item {
7 Text {
8 color: "#ffffff"
9 style: Text.Outline
10 styleColor: "#606060"
11 font.pixelSize: 28
12 property int api: GraphicsInfo.api
13 text: {
14 if (GraphicsInfo.api === GraphicsInfo.OpenGLRhi)
15 "OpenGL on QRhi";
16 else if (GraphicsInfo.api === GraphicsInfo.Direct3D11Rhi)
17 "D3D11 on QRhi";
18 else if (GraphicsInfo.api === GraphicsInfo.VulkanRhi)
19 "Vulkan on QRhi";
20 else if (GraphicsInfo.api === GraphicsInfo.MetalRhi)
21 "Metal on QRhi";
22 else if (GraphicsInfo.api === GraphicsInfo.Null)
23 "Null on QRhi";
24 else
25 "Unknown API";
26 }
27 }
28
29 Text {
30 id: srcItem
31 text: "Hello world"
32 anchors.centerIn: parent
33 color: "red"
34 font.pixelSize: 40
35 }
36
37 ShaderEffectSource {
38 id: src
39 sourceItem: srcItem
40 anchors.fill: srcItem
41 hideSource: true
42 visible: false
43 }
44
45 ShaderEffect {
46 anchors.fill: src
47 property variant source: src
48 property real amplitude: 0.04
49 property real frequency: 5
50 property real time: 0
51 NumberAnimation on time { from: 0; to: Math.PI * 2; duration: 600; loops: -1 }
52 fragmentShader: "wobble.frag.qsb"
53 }
54 }