QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskGradientMaterial.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_GRADIENT_MATERIAL
7#define QSK_GRADIENT_MATERIAL
8
9#include "QskGlobal.h"
10#include "QskGradient.h"
11#include <qsgmaterial.h>
12
13class QSK_EXPORT QskGradientMaterial : public QSGMaterial
14{
15 public:
16 static QskGradientMaterial* createMaterial( QskGradient::Type );
17
18 bool updateGradient( const QRectF&, const QskGradient& );
19 QskGradient::Type gradientType() const;
20
21 const QskGradientStops& stops() const;
22 QskGradient::SpreadMode spreadMode() const;
23
24 protected:
25 QskGradientMaterial( QskGradient::Type );
26
27 void setStops( const QskGradientStops& );
28 void setSpreadMode( QskGradient::SpreadMode );
29
30 private:
31 const QskGradient::Type m_gradientType;
32
33 QskGradientStops m_stops;
34 QskGradient::SpreadMode m_spreadMode = QskGradient::PadSpread;
35};
36
37inline QskGradient::Type QskGradientMaterial::gradientType() const
38{
39 return m_gradientType;
40}
41
42inline void QskGradientMaterial::setStops( const QskGradientStops& stops )
43{
44 m_stops = stops;
45}
46
47inline void QskGradientMaterial::setSpreadMode( QskGradient::SpreadMode spreadMode )
48{
49 m_spreadMode = spreadMode;
50}
51
52inline const QskGradientStops& QskGradientMaterial::stops() const
53{
54 return m_stops;
55}
56
57inline QskGradient::SpreadMode QskGradientMaterial::spreadMode() const
58{
59 return m_spreadMode;
60}
61
62#endif