Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_gradient.h
Go to the documentation of this file.
1/*
2 * kis_tool_line.h - part of Krayon
3 *
4 * SPDX-FileCopyrightText: 2000 John Califf <jcaliff@comuzone.net>
5 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
6 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org>
7 * SPDX-FileCopyrightText: 2004 Adrian Page <adrian@pagenet.plus.com>
8 * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#ifndef KIS_TOOL_GRADIENT_H_
14#define KIS_TOOL_GRADIENT_H_
15
16#include <QKeySequence>
17
19
20#include <kis_tool_paint.h>
21#include <kis_global.h>
22#include <kis_types.h>
26#include <kis_icon.h>
27#include <kconfig.h>
28#include <kconfiggroup.h>
29
30
31class QLabel;
32class QPoint;
33class QWidget;
34class QCheckBox;
35class KComboBox;
37
39{
40
41 Q_OBJECT
42
43public:
45 ~KisToolGradient() override;
46
47 void beginPrimaryAction(KoPointerEvent *event) override;
48 void continuePrimaryAction(KoPointerEvent *event) override;
49 void endPrimaryAction(KoPointerEvent *event) override;
50
51 void paint(QPainter &painter, const KoViewConverter &converter) override;
52
53 QWidget* createOptionWidget() override;
54
55public Q_SLOTS:
56 void activate(const QSet<KoShape*> &shapes) override;
57private Q_SLOTS:
58 void slotSetShape(int);
59 void slotSetRepeat(int);
60 void slotSetReverse(bool);
61 void slotSetDither(int);
62 void slotSetDitherSteps(int);
63 void slotSetAntiAliasThreshold(qreal);
64protected Q_SLOTS:
65 void resetCursorStyle() override;
66
67private Q_SLOTS:
68
69 void areaDone(const QRect & rc) {
70 currentNode()->setDirty(rc); // Starts computing the projection for the area we've done.
71
72 }
73
74private:
75
76 void paintLine(QPainter& gc);
77 void updateGuideline();
78
79 QPointF straightLine(QPointF point);
80
81 QPointF m_startPos;
82 QPointF m_endPos;
83
86
89 bool m_reverse {false};
91
92 QLabel *m_lbShape {nullptr};
93 QLabel *m_lbRepeat {nullptr};
94 QLabel *m_lbDither {nullptr};
95 KComboBox *m_cmbDither {nullptr};
96 QLabel *m_lbDitherSteps {nullptr};
98 QCheckBox *m_ckReverse {nullptr};
99 KComboBox *m_cmbShape {nullptr};
100 KComboBox *m_cmbRepeat {nullptr};
101 QLabel *m_lbAntiAliasThreshold {nullptr};
103 KConfigGroup m_configGroup;
104};
105
107{
108
109public:
111 : KisToolPaintFactoryBase("KritaFill/KisToolGradient") {
112 setToolTip(i18n("Gradient Tool"));
114 setIconName(koIconNameCStr("krita_tool_gradient"));
115 setShortcut(QKeySequence(Qt::Key_G));
116 setPriority(1);
118 }
119
121
123 return new KisToolGradient(canvas);
124 }
125
126};
127
128#endif //KIS_TOOL_GRADIENT_H_
129
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
The KisIntParseSpinBox class is a cleverer SpinBox, able to parse arithmetic expressions.
KoToolBase * createTool(KoCanvasBase *canvas) override
void areaDone(const QRect &rc)
void endPrimaryAction(KoPointerEvent *event) override
void resetCursorStyle() override
KisToolGradient(KoCanvasBase *canvas)
QLabel * m_lbAntiAliasThreshold
void continuePrimaryAction(KoPointerEvent *event) override
QWidget * createOptionWidget() override
KComboBox * m_cmbRepeat
KComboBox * m_cmbDither
void activate(const QSet< KoShape * > &shapes) override
KisGradientPainter::enumDither m_dither
KConfigGroup m_configGroup
KisGradientPainter::enumGradientShape m_shape
void beginPrimaryAction(KoPointerEvent *event) override
void paintLine(QPainter &gc)
KisDoubleSliderSpinBox * m_slAntiAliasThreshold
~KisToolGradient() override
QCheckBox * m_ckReverse
void slotSetAntiAliasThreshold(qreal)
KComboBox * m_cmbShape
KisIntParseSpinBox * m_sbDitherSteps
QPointF straightLine(QPointF point)
void paint(QPainter &painter, const KoViewConverter &converter) override
KisGradientPainter::enumGradientRepeat m_repeat
void setShortcut(const QKeySequence &shortcut)
void setSection(const QString &section)
void setActivationShapeId(const QString &activationShapeId)
void setIconName(const char *iconName)
void setToolTip(const QString &tooltip)
void setPriority(int newPriority)
#define koIconNameCStr(name)
Definition kis_icon.h:28
static const QString KRITA_TOOL_ACTIVATION_ID
Definition kis_tool.h:37
static const QString Fill
Tools that fill parts of the canvas.
static constexpr int defaultDitherSteps
virtual void setDirty()
Definition kis_node.cpp:577
KisNodeSP currentNode() const
Definition kis_tool.cc:370
KisCanvas2 * canvas