File indexing completed on 2024-05-12 15:59:07
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Scott Petrovic <scottpetrovic@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef LIBKIS_SCRATCHPAD_H 0007 #define LIBKIS_SCRATCHPAD_H 0008 0009 #include <QObject> 0010 #include <QColor> 0011 #include <kis_types.h> 0012 #include "kritalibkis_export.h" 0013 #include "libkis.h" 0014 #include "kis_scratch_pad.h" 0015 #include "View.h" 0016 0017 class KoCanvasBase; 0018 class Canvas; // This comes from Python. This would be maybe better 0019 class KisView; 0020 0021 /** 0022 * @brief The Scratchpad class 0023 * A scratchpad is a type of blank canvas area that can be painted on 0024 * with the normal painting devices 0025 * 0026 */ 0027 class KRITALIBKIS_EXPORT Scratchpad: public QWidget 0028 { 0029 Q_OBJECT 0030 public: 0031 Scratchpad(View *view, const QColor & defaultColor, QWidget *parent = 0); 0032 ~Scratchpad(); 0033 0034 public Q_SLOTS: 0035 0036 /** 0037 * @brief Clears out scratchpad with color specfified set during setup 0038 */ 0039 void clear(); 0040 0041 /** 0042 * @brief Fill the entire scratchpad with a color 0043 * @param Color to fill the canvas with 0044 */ 0045 void setFillColor(QColor color); 0046 0047 /** 0048 * @brief Switches between a GUI controlling the current mode and when mouse clicks control mode 0049 * @param Setting to true allows GUI to control the mode with explicitly setting mode 0050 */ 0051 void setModeManually(bool value); 0052 0053 0054 /** 0055 * @brief Manually set what mode scratchpad is in. Ignored if "setModeManually is set to false 0056 * @param Available options are: "painting", "panning", and "colorsampling" 0057 */ 0058 void setMode(QString modeName); 0059 0060 /** 0061 * @brief Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync 0062 * @param Should the scratchpad share the zoom level. Default is true 0063 */ 0064 void linkCanvasZoom(bool value); 0065 0066 0067 /** 0068 * @brief Load image data to the scratchpad 0069 * @param Image object to load 0070 */ 0071 void loadScratchpadImage(QImage image); 0072 0073 /** 0074 * @brief Take what is on the scratchpad area and grab image 0075 * @return the image data from the scratchpage 0076 */ 0077 QImage copyScratchpadImageData(); 0078 0079 0080 private: 0081 struct Private; 0082 const QScopedPointer<Private> d; 0083 0084 }; 0085 0086 #endif // LIBKIS_SCRATCHPAD_H 0087