1 | /* |
---|---|
2 | * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> |
3 | * |
4 | * SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #pragma once |
8 | |
9 | #include <QPointer> |
10 | #include <QSGTextureProvider> |
11 | |
12 | #include "shadowedrectanglenode.h" |
13 | #include "shadowedtexturematerial.h" |
14 | |
15 | /** |
16 | * Scene graph node for a shadowed texture source. |
17 | * |
18 | * This node will set up the geometry and materials for a shadowed rectangle, |
19 | * optionally with rounded corners, using a supplied texture source as the color |
20 | * for the rectangle. |
21 | * |
22 | * \note You must call updateGeometry() after setting properties of this node, |
23 | * otherwise the node's state will not correctly reflect all the properties. |
24 | * |
25 | * \sa ShadowedTexture |
26 | */ |
27 | class ShadowedTextureNode : public ShadowedRectangleNode |
28 | { |
29 | public: |
30 | ShadowedTextureNode(); |
31 | ~ShadowedTextureNode(); |
32 | |
33 | void setTextureSource(QSGTextureProvider *source); |
34 | void preprocess() override; |
35 | |
36 | private: |
37 | ShadowedRectangleMaterial *createBorderlessMaterial() override; |
38 | ShadowedBorderRectangleMaterial *createBorderMaterial() override; |
39 | QSGMaterialType *borderlessMaterialType() override; |
40 | QSGMaterialType *borderMaterialType() override; |
41 | |
42 | QPointer<QSGTextureProvider> m_textureSource; |
43 | QMetaObject::Connection m_textureChangeConnectionHandle; |
44 | }; |
45 |