Krita

Scratchpad.cpp
1 /*
2  * SPDX-FileCopyrightText: 2020 Scott Petrovic <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #include "Scratchpad.h"
7 #include <KoResource.h>
8 #include <kis_config.h>
9 #include "kis_scratch_pad.h"
10 #include "Resource.h"
11 #include "View.h"
12 #include "Canvas.h"
13 #include <KoCanvasBase.h>
14 #include <kis_canvas2.h>
15 
16 #include <QColor>
17 #include <QVBoxLayout>
18 
19 
20 struct Scratchpad::Private
21 {
22  KisScratchPad *scratchpad = 0;
23 };
24 
25 
26 Scratchpad::Scratchpad(View *view, const QColor & defaultColor, QWidget *parent)
27  : QWidget(parent), d(new Private)
28 {
29  d->scratchpad = new KisScratchPad();
30  d->scratchpad->setupScratchPad(view->view()->resourceProvider(), defaultColor);
31  d->scratchpad->setMinimumSize(50, 50);
32 
33  QVBoxLayout *layout = new QVBoxLayout(this);
34  layout->addWidget(d->scratchpad);
35 }
36 
37 Scratchpad::~Scratchpad()
38 {
39 }
40 
42 {
43  d->scratchpad->setModeManually(value);
44 }
45 
47 {
48  d->scratchpad->setModeType(modeType);
49 }
50 
52 {
53  d->scratchpad->linkCanvasToZoomLevel(value);
54 }
55 
57 {
58  d->scratchpad->loadScratchpadImage(image);
59 }
60 
62 {
63  return d->scratchpad->copyScratchpadImageData();
64 }
65 
67 {
68  // need ability to set color
69  d->scratchpad->fillDefault();
70 }
71 
73 {
74  d->scratchpad->setFillColor(color);
75 }
void loadScratchpadImage(QImage image)
Load image data to the scratchpad.
Definition: Scratchpad.cpp:56
void clear()
Clears out scratchpad with color specified set during setup.
Definition: Scratchpad.cpp:66
View represents one view on a document.
Definition: View.h:24
void setModeManually(bool value)
Switches between a GUI controlling the current mode and when mouse clicks control mode.
Definition: Scratchpad.cpp:41
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
void setFillColor(QColor color)
Fill the entire scratchpad with a color.
Definition: Scratchpad.cpp:72
void setMode(QString modeName)
Manually set what mode scratchpad is in.
Definition: Scratchpad.cpp:46
void linkCanvasZoom(bool value)
Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync.
Definition: Scratchpad.cpp:51
QImage copyScratchpadImageData()
Take what is on the scratchpad area and grab image.
Definition: Scratchpad.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:09:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.