QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskStippledLineRenderer.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_STIPPLED_LINE_RENDERER_H
7#define QSK_STIPPLED_LINE_RENDERER_H
8
9#include "QskStippleMetrics.h"
10
11class QLineF;
12class QPointF;
13
14/*
15 A wrapper for the non public QDashStroker class, tailored for
16 splitting lines into dashes/dots. It is faster than QPainterPathStroker
17 ( no QPainterPath involved ), but supports simple lines only.
18 */
20{
21 public:
24
25 qsizetype dashCount( qreal x1, qreal y1, qreal x2, qreal y2 ) const;
26 qsizetype dashCount( const QPointF&, const QPointF& ) const;
27 qsizetype dashCount( const QLineF& ) const;
28
29 void renderLine( qreal x1, qreal y1, qreal x2, qreal y2 );
30 void renderLine( const QPointF&, const QPointF& );
31 void renderLine( const QLineF& );
32
33 const QskStippleMetrics& metrics() const;
34
35 // nop: to be overloaded
36 virtual void renderDash( qreal x1, qreal y1, qreal x2, qreal y2 );
37
38 private:
39 const QskStippleMetrics m_metrics;
40};
41
42inline const QskStippleMetrics& QskStippledLineRenderer::metrics() const
43{
44 return m_metrics;
45}
46
47#endif