File indexing completed on 2024-05-12 15:58:37

0001 /*
0002  *  SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H
0008 #define __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H
0009 
0010 #include "kis_gradient_shape_strategy.h"
0011 
0012 #include <QPolygonF>
0013 #include <QPainterPath>
0014 
0015 #include "kritaimage_export.h"
0016 
0017 
0018 class KRITAIMAGE_EXPORT KisPolygonalGradientShapeStrategy : public KisGradientShapeStrategy
0019 {
0020 public:
0021     KisPolygonalGradientShapeStrategy(const QPainterPath &selectionPath,
0022                                       qreal exponent);
0023     ~KisPolygonalGradientShapeStrategy() override;
0024 
0025     double valueAt(double x, double y) const override;
0026 
0027     static QPointF testingCalculatePathCenter(int numSamples, const QPainterPath &path, qreal exponent, bool searchForMax);
0028 
0029 private:
0030     QPainterPath m_selectionPath;
0031 
0032     qreal m_exponent;
0033     qreal m_minWeight;
0034     qreal m_maxWeight;
0035     qreal m_scaleCoeff;
0036 };
0037 
0038 #endif /* __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H */