Krita Source Code Documentation
Loading...
Searching...
No Matches
KoGamutMask.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Anna Medonosova <anna.medonosova@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KOGAMUTMASK_H
8#define KOGAMUTMASK_H
9
10#include <QPainter>
11#include <QString>
12#include <QVector>
13#include <cmath>
14
15#include <FlakeDebug.h>
16#include <KoResource.h>
17#include <KoShape.h>
18
19//class KoViewConverter;
20class QTransform;
21
23{
24public:
28
29 bool coordIsClear(const QPointF& coord) const;
30 QPainterPath outline();
31 void paint(QPainter &painter);
32 void paintStroke(QPainter &painter);
34
35private:
36 KoShape* m_maskShape {nullptr};
37};
38
39
43class KRITAFLAKE_EXPORT KoGamutMask : public QObject, public KoResource
44{
45 Q_OBJECT
46
47public:
48 KoGamutMask(const QString &filename);
51 KoGamutMask(const KoGamutMask &rhs);
52 KoGamutMask &operator=(const KoGamutMask &rhs) = delete;
53 KoResourceSP clone() const override;
54 ~KoGamutMask() override;
55
56 bool coordIsClear(const QPointF& coord, bool preview);
57 bool loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override;
58 bool saveToDevice(QIODevice* dev) const override;
59
60 QPair<QString, QString> resourceType() const override
61 {
62 return QPair<QString, QString>(ResourceType::GamutMasks, "");
63 }
64
65 void paint(QPainter &painter, bool preview);
66 void paintStroke(QPainter &painter, bool preview);
67
68 QTransform maskToViewTransform(qreal viewSize);
69 QTransform viewToMaskTransform(qreal viewSize);
70
71 QString title() const;
72 void setTitle(QString title);
73
74 QString description() const;
75 void setDescription(QString description);
76
77 QString defaultFileExtension() const override;
78
79 int rotation();
80 void setRotation(int rotation);
81
82 QSizeF maskSize();
83
84 void setMaskShapes(QList<KoShape*> shapes);
85 void setPreviewMaskShapes(QList<KoShape*> shapes);
86
87 QList<KoShape*> koShapes() const;
88
89 void clearPreview();
90
91private:
92 void setMaskShapesToVector(QList<KoShape*> shapes, QVector<KoGamutMaskShape*>& targetVector);
93
94 struct Private;
95 Private* const d;
96};
97
99
100#endif // KOGAMUTMASK_H
QSharedPointer< KoGamutMask > KoGamutMaskSP
Definition KoGamutMask.h:98
bool coordIsClear(const QPointF &coord) const
void paintStroke(QPainter &painter)
void paint(QPainter &painter)
KoShape * m_maskShape
Definition KoGamutMask.h:36
KoShape * koShape()
QPainterPath outline()
The resource type for gamut masks used by the artistic color selector.
Definition KoGamutMask.h:44
QPair< QString, QString > resourceType() const override
Definition KoGamutMask.h:60
KoGamutMask & operator=(const KoGamutMask &rhs)=delete
Private *const d
Definition KoGamutMask.h:95
bool loadFromDevice(QIODevice *)
const QString GamutMasks
virtual KoResourceSP clone() const =0
virtual QString defaultFileExtension() const
virtual bool saveToDevice(QIODevice *dev) const