Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_selection.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KIS_SELECTION_H_
7#define KIS_SELECTION_H_
8
9#include <QRect>
10
11#include "kis_types.h"
12#include "kritaimage_export.h"
13
14#include "KisSelectionTags.h"
15
16#include "kis_pixel_selection.h"
17
18
20class QPainterPath;
21
36class KRITAIMAGE_EXPORT KisSelection : public KisShared
37{
38private:
39 struct ChangeShapeSelectionCommand;
40
41public:
42
47
57
61 KisSelection(const KisSelection& rhs);
63
69 virtual ~KisSelection();
70
74 KisSelection(const KisPaintDeviceSP copySource, KritaUtils::DeviceCopyMode copyMode, KisDefaultBoundsBaseSP defaultBounds, KisImageResolutionProxySP resolutionProxy);
75
82 void setParentNode(KisNodeWSP node);
83
84 bool hasNonEmptyPixelSelection() const;
85 bool hasNonEmptyShapeSelection() const;
86 bool hasShapeSelection() const;
87
88 bool outlineCacheValid() const;
89 QPainterPath outlineCache() const;
90 void recalculateOutlineCache();
91
92
96 bool thumbnailImageValid() const;
97
101 void recalculateThumbnailImage(const QColor &maskColor);
102
106 QImage thumbnailImage() const;
107
112 QTransform thumbnailImageTransform() const;
113
114
128
134
145 KUndo2Command* convertToVectorSelection(KisSelectionComponent* shapeSelection);
146
150 void convertToVectorSelectionNoUndo(KisSelectionComponent* shapeSelection);
151
157 KisPixelSelectionSP projection() const;
158
164 void updateProjection(const QRect& rect);
165 void updateProjection();
166
167 void setVisible(bool visible);
168 bool isVisible();
169
174 bool isTotallyUnselected(const QRect & r) const;
175
176 QRect selectedRect() const;
177
186 QRect selectedExactRect() const;
187
188 void setX(qint32 x);
189 void setY(qint32 y);
190
191 qint32 x() const;
192 qint32 y() const;
193
194 void setDefaultBounds(KisDefaultBoundsBaseSP bounds);
195 void setResolutionProxy(KisImageResolutionProxySP proxy);
197
198 void clear();
199
205 KUndo2Command* flatten();
206
207 void notifySelectionChanged();
208
214 void requestCompressedProjectionUpdate(const QRect &rc);
215
218 quint8 selected(qint32 x, qint32 y) const;
219
221
222private:
223 friend class KisSelectionTest;
224 friend class KisMaskTest;
225 friend class KisAdjustmentLayerTest;
229
230 void copyFrom(const KisSelection &rhs);
231
232private:
233
234 struct Private;
235 Private * const m_d;
236};
237
238#endif // KIS_SELECTION_H_
KisShared & operator=(const KisShared &)
#define bounds(x, a, b)
KisNodeWSP parentNode() const
KisPixelSelectionSP pixelSelection() const
KisSelectionComponent * shapeSelection() const
bool isVisible()
Private *const m_d
KisImageResolutionProxySP resolutionProxy() const