Kirigami2

shadowedborderrectanglematerial.h
1 /*
2  * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <[email protected]>
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  */
18 {
19 public:
21 
22 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
23  QSGMaterialShader *createShader() const override;
24 #else
25  QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override;
26 #endif
27  QSGMaterialType *type() const override;
28  int compare(const QSGMaterial *other) const override;
29 
30  float borderWidth = 0.0;
31  QColor borderColor = Qt::black;
32 
33  static QSGMaterialType staticType;
34 };
35 
36 class ShadowedBorderRectangleShader : public ShadowedRectangleShader
37 {
38 public:
39  ShadowedBorderRectangleShader(ShadowedRectangleMaterial::ShaderType shaderType);
40 
41 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
42  void initialize() override;
43  void updateState(const QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
44 
45 private:
46  int m_borderWidthLocation = -1;
47  int m_borderColorLocation = -1;
48 #else
49  bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
50 #endif
51 };
A material rendering a rectangle with a shadow and a border.
virtual QSGMaterialShader * createShader() const const=0
A material rendering a rectangle with a shadow.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.