| 1 | /* |
| 2 | * SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef PIECHARTMATERIAL_H |
| 8 | #define PIECHARTMATERIAL_H |
| 9 | |
| 10 | #include <QColor> |
| 11 | #include <QSGMaterial> |
| 12 | #include <QSGMaterialShader> |
| 13 | |
| 14 | #include "SDFShader.h" |
| 15 | |
| 16 | class BarChartMaterial : public QSGMaterial |
| 17 | { |
| 18 | public: |
| 19 | BarChartMaterial(); |
| 20 | ~BarChartMaterial(); |
| 21 | |
| 22 | QSGMaterialType *type() const override; |
| 23 | QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override; |
| 24 | int compare(const QSGMaterial *other) const override; |
| 25 | |
| 26 | QVector2D aspect = QVector2D{1.0, 1.0}; |
| 27 | float radius = 0.0; |
| 28 | QColor backgroundColor = Qt::transparent; |
| 29 | }; |
| 30 | |
| 31 | class BarChartShader : public SDFShader |
| 32 | { |
| 33 | public: |
| 34 | BarChartShader(); |
| 35 | ~BarChartShader(); |
| 36 | |
| 37 | bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; |
| 38 | }; |
| 39 | |
| 40 | #endif // PIECHARTMATERIAL_H |
| 41 | |