QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskFillNode.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_FILL_NODE_H
7#define QSK_FILL_NODE_H
8
9#include "QskGlobal.h"
10#include <qsgnode.h>
11#include <qcolor.h>
12
13class QskFillNodePrivate;
14class QskGradient;
15
16class QSK_EXPORT QskFillNode : public QSGGeometryNode
17{
18 Q_GADGET
19
20 using Inherited = QSGGeometryNode;
21
22 public:
23 enum Coloring
24 {
25 Monochrome,
26 Polychrome,
27
28 Linear,
29 Radial,
30 Conic
31 };
32
33 enum Hint
34 {
35 /*
36 Colors might be defined in the material ( QskGradientMaterial,
37 QSGFlatColorMaterial ) or attached to each point ( QSGVertexColorMaterial ).
38
39 Having colored points makes the material independent of the coloring
40 and the scene graph is able to batch the geometries
41 ( https://doc.qt.io/qt-6/qtquick-visualcanvas-scenegraph.html ).
42
43 Having the colors in the material needs less memory and avoids updates
44 of the geometry only because of recoloring.
45
46 The default setting is to use colored points where possible. Note, that
47 this is what is also done in the Qt/Quick classes.
48 */
49 PreferColoredGeometry = 1
50 };
51
52 Q_ENUM( Hint )
53 Q_DECLARE_FLAGS( Hints, Hint )
54
56 ~QskFillNode() override;
57
58 void resetGeometry();
59
60 void setColoring( Coloring );
61 Coloring coloring() const;
62
63 void setColoring( QRgb );
64 void setColoring( const QColor& );
65 void setColoring( Qt::GlobalColor );
66
67 void setColoring( const QRectF&, const QskGradient& );
68
69 bool isGeometryColored() const;
70
71 void setHints( Hints );
72 Hints hints() const;
73
74 void setHint( Hint, bool on = true );
75 bool hasHint( Hint ) const;
76
77 protected:
78 QskFillNode( QskFillNodePrivate& );
79
80 private:
81 Q_DECLARE_PRIVATE( QskFillNode )
82};
83
84inline void QskFillNode::setColoring( QRgb rgb )
85{
86 setColoring( QColor::fromRgba( rgb ) );
87}
88
89inline void QskFillNode::setColoring( Qt::GlobalColor color )
90{
91 setColoring( QColor( color ) );
92}
93
94#endif