QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskBoxBasicStroker.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_BOX_BASIC_STROKER_H
7#define QSK_BOX_BASIC_STROKER_H
8
9#include "QskBoxMetrics.h"
10#include "QskBoxBorderColors.h"
11#include "QskVertexHelper.h"
12
15
16namespace QskVertex
17{
18 class Line;
19 class ColoredLine;
20}
21
23{
24 public:
28 const QskBoxBorderColors&, const QskVertex::ColorMap& );
29
30 int fillCount() const;
31 int borderCount() const;
32
33 /*
34 QskVertex::Line ( = QSGGeometry::Point2D )
35
36 Needed for:
37
38 - monochrome coloring ( QSGSimpleMaterial )
39 - clipping ( QSGClipNode )
40 - shaders getting the color information from a color ramp
41 ( = QskGradientMatrial )
42 */
43
44 void setBorderLines( QskVertex::Line* ) const;
45 void setFillLines( QskVertex::Line* ) const;
46
47 /*
48 QskVertex::ColoredLine ( = QSGGeometry::ColoredPoint2D )
49
50 The color information is added to the geometry what allows
51 using the same shader regardless of the colors, what ends
52 up in better scene graph batching
53 */
54
55 void setBorderLines( QskVertex::ColoredLine* ) const;
56 void setFillLines( QskVertex::ColoredLine* ) const;
57
58 void setBoxLines( QskVertex::ColoredLine*, QskVertex::ColoredLine* ) const;
59
60 private:
61
62 class GeometryLayout
63 {
64 public:
65 GeometryLayout( const QskBoxMetrics&, const QskBoxBorderColors& );
66
67 int cornerOffsets[ 4 ];
68 int edgeOffsets[ 4 ];
69
70 int closingOffsets[2];
71 int lineCount;
72 };
73
74 void setBorderGradientLines( QskVertex::ColoredLine* ) const;
75 void setBorderGradientLines( Qt::Edge, QskVertex::ColoredLine* ) const;
76
77 void setBorderAndFillLines( QskVertex::ColoredLine*, QskVertex::ColoredLine* ) const;
78
79 const QskBoxMetrics& m_metrics;
80 const QskBoxBorderColors m_borderColors;
81 const QskVertex::ColorMap m_colorMap;
82 const GeometryLayout m_geometryLayout;
83
84 const bool m_isColored;
85};
86
87#endif