File indexing completed on 2025-01-26 04:05:53

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISSTROKESPEEDMEASURER_H
0008 #define KISSTROKESPEEDMEASURER_H
0009 
0010 #include "kritaimage_export.h"
0011 #include <QScopedPointer>
0012 
0013 #include <QtGlobal>
0014 
0015 class QPointF;
0016 
0017 
0018 class KRITAIMAGE_EXPORT KisStrokeSpeedMeasurer
0019 {
0020 public:
0021     KisStrokeSpeedMeasurer(int timeSmoothWindow);
0022     ~KisStrokeSpeedMeasurer();
0023 
0024     void addSample(const QPointF &pt, int time);
0025     void addSamples(const QVector<QPointF> &points, int time);
0026 
0027     qreal averageSpeed() const;
0028     qreal currentSpeed() const;
0029     qreal maxSpeed() const;
0030 
0031     void reset();
0032 
0033 private:
0034     void sampleMaxSpeed();
0035 
0036 private:
0037     struct Private;
0038     const QScopedPointer<Private> m_d;
0039 };
0040 
0041 #endif // KISSTROKESPEEDMEASURER_H