File indexing completed on 2024-05-05 03:56:28

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "shadowedrectanglematerial.h"
0010 
0011 /**
0012  * A material rendering a rectangle with a shadow and a border.
0013  *
0014  * This material uses a distance field shader to render a rectangle with a
0015  * shadow below it, optionally with rounded corners and a border.
0016  */
0017 class ShadowedBorderRectangleMaterial : public ShadowedRectangleMaterial
0018 {
0019 public:
0020     ShadowedBorderRectangleMaterial();
0021 
0022     QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override;
0023     QSGMaterialType *type() const override;
0024     int compare(const QSGMaterial *other) const override;
0025 
0026     float borderWidth = 0.0;
0027     QColor borderColor = Qt::black;
0028 
0029     static QSGMaterialType staticType;
0030 };
0031 
0032 class ShadowedBorderRectangleShader : public ShadowedRectangleShader
0033 {
0034 public:
0035     ShadowedBorderRectangleShader(ShadowedRectangleMaterial::ShaderType shaderType);
0036 
0037     bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
0038 };