File indexing completed on 2024-12-22 04:16:39
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Kuntal Majumder <hellozee@disroot.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only 0005 */ 0006 0007 #ifndef KISMAGNETICWORKER_H 0008 #define KISMAGNETICWORKER_H 0009 0010 #include <kis_paint_device.h> 0011 #include <kritaselectiontools_export.h> 0012 0013 struct KisMagneticGraph; 0014 0015 class KisMagneticLazyTiles { 0016 private: 0017 QVector<QRect> m_tiles; 0018 QVector<qreal> m_radiusRecord; 0019 KisPaintDeviceSP m_dev; 0020 QSize m_tileSize; 0021 int m_tilesPerRow; 0022 0023 public: 0024 KisMagneticLazyTiles(KisPaintDeviceSP dev); 0025 void filter(qreal radius, QRect &rect); 0026 inline KisPaintDeviceSP device(){ return m_dev; } 0027 inline QVector<QRect> tiles(){ return m_tiles; } 0028 }; 0029 0030 class KRITASELECTIONTOOLS_EXPORT KisMagneticWorker { 0031 public: 0032 KisMagneticWorker(const KisPaintDeviceSP &dev); 0033 0034 QVector<QPointF> computeEdge(int bounds, QPoint start, QPoint end, qreal radius); 0035 void saveTheImage(vQPointF points); 0036 qreal intensity(QPoint pt); 0037 0038 private: 0039 KisMagneticLazyTiles m_lazyTileFilter; 0040 KisMagneticGraph *m_graph {nullptr}; 0041 }; 0042 0043 #endif // ifndef KISMAGNETICWORKER_H