File indexing completed on 2024-05-12 16:01:41
0001 /* 0002 * SPDX-FileCopyrightText: 2008 Sven Langkamp <sven.langkamp@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef _KIS_SELECTION_DECORATION_H_ 0008 #define _KIS_SELECTION_DECORATION_H_ 0009 0010 #include <QPainterPath> 0011 #include <QTimer> 0012 #include <QPolygon> 0013 #include <QPen> 0014 0015 #include <kis_signal_compressor.h> 0016 #include "canvas/kis_canvas_decoration.h" 0017 0018 class KisView; 0019 class QWindow; 0020 class QScreen; 0021 0022 class KRITAUI_EXPORT KisSelectionDecoration : public KisCanvasDecoration 0023 { 0024 Q_OBJECT 0025 public: 0026 KisSelectionDecoration(QPointer<KisView> view); 0027 ~KisSelectionDecoration() override; 0028 0029 enum Mode { 0030 Ants, 0031 Mask 0032 }; 0033 0034 Mode mode() const; 0035 void setMode(Mode mode); 0036 void setVisible(bool v) override; 0037 0038 void notifyWindowMinimized(bool minimized) override; 0039 0040 protected: 0041 void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas) override; 0042 0043 private Q_SLOTS: 0044 void slotStartUpdateSelection(); 0045 void slotConfigChanged(); 0046 void screenChanged(QScreen *screen); 0047 void initializePens(); 0048 0049 public Q_SLOTS: 0050 void selectionChanged(); 0051 void antsAttackEvent(); 0052 private: 0053 bool selectionIsActive(); 0054 0055 private: 0056 0057 KisSignalCompressor m_signalCompressor; 0058 QPainterPath m_outlinePath; 0059 QImage m_thumbnailImage; 0060 QTransform m_thumbnailImageTransform; 0061 QTimer* m_antsTimer; 0062 int m_offset; 0063 0064 QPen m_antsPen; 0065 QPen m_outlinePen; 0066 Mode m_mode; 0067 0068 QColor m_maskColor; 0069 bool m_antialiasSelectionOutline; 0070 0071 QWindow *m_window; 0072 QScreen *m_screen; 0073 }; 0074 0075 #endif