Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_pixel_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_PIXEL_SELECTION_H_
7#define KIS_PIXEL_SELECTION_H_
8
9#include <QRect>
10#include <QPainterPath>
11
12#include "kis_types.h"
13#include "kis_global.h"
14#include "kis_paint_device.h"
16#include "kis_selection.h"
17#include <kritaimage_export.h>
18
19
24class KRITAIMAGE_EXPORT KisPixelSelection : public KisPaintDevice, public KisSelectionComponent
25{
26
27public:
28
34
39
44
45 ~KisPixelSelection() override;
46
48
49 const KoColorSpace* compositionSourceColorSpace() const override;
50
51 bool read(QIODevice *stream);
52
56 void select(const QRect & r, quint8 selectedness = MAX_SELECTED);
57
63 void invert();
64
68 void clear(const QRect & r);
69
74 void clear() override;
75
79 void copyAlphaFrom(KisPaintDeviceSP src, const QRect &processRect);
80
84 void applySelection(KisPixelSelectionSP selection, SelectionAction action);
85
87 bool isTotallyUnselected(const QRect & r) const;
88
93 QRect selectedRect() const;
94
99 QRect selectedExactRect() const;
100
105 QVector<QPolygon> outline() const;
106
110 void moveTo(const QPoint& pt) override;
112
113 bool isEmpty() const override;
114 QPainterPath outlineCache() const override;
115 bool outlineCacheValid() const override;
116 void recalculateOutlineCache() override;
117
118 void setOutlineCache(const QPainterPath &cache);
119 void invalidateOutlineCache();
120
122 QImage thumbnailImage() const;
123 QTransform thumbnailImageTransform() const;
124 void recalculateThumbnailImage(const QColor &maskColor);
125
126
127 void setParentSelection(KisSelectionWSP selection);
129
130 void renderToProjection(KisPaintDeviceSP projection) override;
131 void renderToProjection(KisPaintDeviceSP projection, const QRect& r) override;
132
133private:
137 void addSelection(KisPixelSelectionSP selection);
138
142 void subtractSelection(KisPixelSelectionSP selection);
143
147 void intersectSelection(KisPixelSelectionSP selection);
148
152 void symmetricdifferenceSelection(KisPixelSelectionSP selection);
153
154private:
155 // We don't want these methods to be used on selections:
158
159private:
160
161 struct Private;
162 Private * const m_d;
163};
164
165#endif // KIS_PIXEL_SELECTION_H_
SelectionAction
bool read(QIODevice *stream)
virtual void clear()
virtual const KoColorSpace * compositionSourceColorSpace() const
QRect exactBounds() const
QRect extent() const
void moveTo(qint32 x, qint32 y)
virtual bool isEmpty() const =0
virtual void renderToProjection(KisPaintDeviceSP projection)=0
virtual KisSelectionComponent * clone(KisSelection *selection)=0
virtual void recalculateOutlineCache()=0
KisSharedPtr< KisDefaultBoundsBase > KisDefaultBoundsBaseSP
const quint8 MAX_SELECTED
Definition kis_global.h:32
KisWeakSharedPtr< KisSelection > KisSelectionWSP
Definition kis_types.h:150
bool thumbnailImageValid() const
bool outlineCacheValid() const override
KisSelectionWSP parentSelection() const
QPainterPath outlineCache() const override
QImage thumbnailImage() const
QTransform thumbnailImageTransform() const