1 #pragma once 2 3 #ifndef T_BLUREDBRUSH 4 #define T_BLUREDBRUSH 5 6 #include "traster.h" 7 #include "trastercm.h" 8 #include "tcurves.h" 9 #include <QPainter> 10 #include <QImage> 11 #include <QSet> 12 13 //======================================================= 14 // 15 // BluredBrush 16 // 17 //======================================================= 18 19 class BluredBrush { 20 TRaster32P m_ras; 21 QImage m_rasImage; 22 int m_size; 23 QRadialGradient m_gradient; 24 TThickPoint m_lastPoint; 25 double m_oldOpacity; 26 bool m_enableDinamicOpacity; 27 28 QSet<int> m_aboveStyleIds; 29 30 double getNextPadPosition(const TThickQuadratic &q, double t) const; 31 32 public: 33 BluredBrush(const TRaster32P &ras, int size, const QRadialGradient &gradient, 34 bool doDinamicOpacity); 35 ~BluredBrush(); 36 37 void addPoint(const TThickPoint &p, double opacity); 38 void addArc(const TThickPoint &pa, const TThickPoint &pb, 39 const TThickPoint &pc, double opacityA, double opacityC); 40 TRect getBoundFromPoints(const std::vector<TThickPoint> &points) const; 41 // colormapped 42 void updateDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM, 43 const TRect &bbox, int styleId, int drawOrderMode) const; 44 void eraseDrawing(const TRasterCM32P rasCM, const TRasterCM32P rasBackupCM, 45 const TRect &bbox, bool selective, int selectedStyleId, 46 const std::wstring &mode) const; 47 setAboveStyleIds(QSet<int> & ids)48 void setAboveStyleIds(QSet<int> &ids) { m_aboveStyleIds = ids; } 49 50 // fullcolor 51 void updateDrawing(const TRasterP ras, const TRasterP rasBackup, 52 const TPixel32 &color, const TRect &bbox, 53 double opacity) const; 54 void eraseDrawing(const TRasterP ras, const TRasterP rasBackup, 55 const TRect &bbox, double opacity) const; 56 }; 57 58 #endif // T_BLUREDBRUSH 59