Krita Source Code Documentation
Loading...
Searching...
No Matches
KisReferenceImage.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KISREFERENCEIMAGE_H
8#define KISREFERENCEIMAGE_H
9
10#include <QSharedDataPointer>
11
12#include <KoColor.h>
13#include <KoTosContainer.h>
14#include <kis_types.h>
15#include <kritaui_export.h>
16#include <kundo2command.h>
17
18class QImage;
19class QPointF;
20class QPainter;
21class QRectF;
22class KoStore;
24class KisCanvas2;
25
29class KRITAUI_EXPORT KisReferenceImage : public KoTosContainer
30{
31public:
32 struct KRITAUI_EXPORT SetSaturationCommand : public KUndo2Command {
36
37 explicit SetSaturationCommand(const QList<KoShape *> &images, qreal newSaturation, KUndo2Command *parent = 0);
38 void undo() override;
39 void redo() override;
40 };
41
45
46 KoShape *cloneShape() const override;
47
53 static KisReferenceImage * fromFile(const QString &filename, const KisCoordinatesConverter &converter, QWidget *parent /*= nullptr*/);
54 static KisReferenceImage * fromClipboard(const KisCoordinatesConverter &converter);
55 static KisReferenceImage * fromQImage(const KisCoordinatesConverter &converter, const QImage &img);
56
61 static KisReferenceImage *
62 fromPaintDevice(KisPaintDeviceSP src, const KisCoordinatesConverter &converter, QWidget *parent);
63
64 void setSaturation(qreal saturation);
65 qreal saturation() const;
66
67 void setEmbed(bool embed);
68 bool embed();
69 bool hasLocalFile();
70
71 void setFilename(const QString &filename);
72 QString filename() const;
73 QString internalFile() const;
74
75 void paint(QPainter &gc) const override;
76
77 QColor getPixel(QPointF position);
78
79 void saveXml(QDomDocument &document, QDomElement &parentElement, int id);
80 bool saveImage(KoStore *store) const;
81
82 static KisReferenceImage * fromXml(const QDomElement &elem);
83 bool loadImage(KoStore *store);
84
85 QImage getImage();
86
87private:
88 struct Private;
89 QSharedDataPointer<Private> d;
90};
91
92#endif // KISREFERENCEIMAGE_H
void setSaturation(TReal &r, TReal &g, TReal &b, TReal sat)
The KisReferenceImage class represents a single reference image.
QSharedDataPointer< Private > d
void paint(QPainter &painter) const override
reimplemented
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
Definition KoShape.cpp:200
QVector< KisReferenceImage * > images