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 "shadowedrectanglematerial.h" |
10 | |
11 | /** |
12 | * A material rendering a rectangle with a shadow and a border. |
13 | * |
14 | * This material uses a distance field shader to render a rectangle with a |
15 | * shadow below it, optionally with rounded corners and a border. |
16 | */ |
17 | class ShadowedBorderRectangleMaterial : public ShadowedRectangleMaterial |
18 | { |
19 | public: |
20 | ShadowedBorderRectangleMaterial(); |
21 | |
22 | QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override; |
23 | QSGMaterialType *type() const override; |
24 | int compare(const QSGMaterial *other) const override; |
25 | |
26 | float borderWidth = 0.0; |
27 | QColor borderColor = Qt::black; |
28 | |
29 | static QSGMaterialType staticType; |
30 | }; |
31 | |
32 | class ShadowedBorderRectangleShader : public ShadowedRectangleShader |
33 | { |
34 | public: |
35 | ShadowedBorderRectangleShader(ShadowedRectangleMaterial::ShaderType shaderType); |
36 | |
37 | bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; |
38 | }; |
39 | |