Krita Source Code Documentation
Loading...
Searching...
No Matches
Scratchpad.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Scott Petrovic <scottpetrovic@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_SCRATCHPAD_H
7#define LIBKIS_SCRATCHPAD_H
8
9#include <QObject>
10#include <QColor>
11#include <QWidget>
12
13#include <kis_types.h>
14
15#include "libkis.h"
16#include "View.h"
17
18#include "kritalibkis_export.h"
19
20
21class KoCanvasBase;
22class Canvas; // This comes from Python. This would be maybe better
23class KisView;
24
31class KRITALIBKIS_EXPORT Scratchpad: public QWidget
32{
33 Q_OBJECT
34public:
35 Scratchpad(View *view, const QColor & defaultColor, QWidget *parent = 0);
37
38public Q_SLOTS:
39
43 void clear();
44
48 void fillDefault();
49
73 void fillGradient(const QPoint &gradientVectorStart = QPoint(),
74 const QPoint &gradientVectorEnd = QPoint(),
75 const QString &gradientShape = "linear",
76 const QString &gradientRepeat = "none",
77 bool reverseGradient = false,
78 bool dither = false);
79
83 void fillBackground();
84
88 void fillForeground();
89
93 void fillTransparent();
94
99 void fillDocument(bool fullContent = true);
100
105 void fillLayer(bool fullContent = true);
106
111 void fillPattern(QTransform transform = QTransform());
112
117 void setFillColor(QColor color);
118
123 void setModeManually(bool value);
124
132 void setMode(QString modeName);
133
140 void linkCanvasZoom(bool value);
141
146 bool canvasZoomLink();
147
153 void setCanvasZoomLink(bool value);
154
159 qreal scale();
160
167 bool setScale(qreal scale) const;
168
173 void scaleToFit();
174
179 void scaleReset();
180
187 void panTo(qint32 x, qint32 y);
188
192 void panCenter();
193
198 void loadScratchpadImage(QImage image);
199
204 QImage copyScratchpadImageData();
205
228 QRect viewportBounds() const;
229
235 QRect contentBounds() const;
236
237Q_SIGNALS:
242 void scaleChanged(qreal scale);
243
248
253 void viewportChanged(const QRect rect);
254
255private:
256 struct Private;
257 const QScopedPointer<Private> d;
258
259};
260
261#endif // LIBKIS_SCRATCHPAD_H
262
float value(const T *src, size_t ch)
The Scratchpad class A scratchpad is a type of blank canvas area that can be painted on with the norm...
Definition Scratchpad.h:32
void contentChanged()
signal is emitted when scratchpad content is changed (stroke or fill)
void scaleChanged(qreal scale)
signal is emitted when scratchpad scale is changed (from zoom canvas or manually)
void viewportChanged(const QRect rect)
signal is emitted when scratchpad viewport has been modified (pan, zoom)
const QScopedPointer< Private > d
Definition Scratchpad.h:257
Definition View.h:25