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>
25#include <kis_icon.h>
26#include <kconfig.h>
27#include <kconfiggroup.h>
28
29
30class QLabel;
31class QPoint;
32class QWidget;
33class QCheckBox;
34class KComboBox;
36
38{
39
40 Q_OBJECT
41
42public:
44 ~KisToolGradient() override;
45
46 void beginPrimaryAction(KoPointerEvent *event) override;
47 void continuePrimaryAction(KoPointerEvent *event) override;
48 void endPrimaryAction(KoPointerEvent *event) override;
49
50 void paint(QPainter &painter, const KoViewConverter &converter) override;
51
52 QWidget* createOptionWidget() override;
53
54public Q_SLOTS:
55 void activate(const QSet<KoShape*> &shapes) override;
56private Q_SLOTS:
57 void slotSetShape(int);
58 void slotSetRepeat(int);
59 void slotSetReverse(bool);
60 void slotSetDither(bool);
61 void slotSetAntiAliasThreshold(qreal);
62protected Q_SLOTS:
63 void resetCursorStyle() override;
64
65private Q_SLOTS:
66
67 void areaDone(const QRect & rc) {
68 currentNode()->setDirty(rc); // Starts computing the projection for the area we've done.
69
70 }
71
72private:
73
74 void paintLine(QPainter& gc);
75 void updateGuideline();
76
77 QPointF straightLine(QPointF point);
78
79 QPointF m_startPos;
80 QPointF m_endPos;
81
84
85 bool m_dither {false};
86 bool m_reverse {false};
88
89 QLabel *m_lbShape {nullptr};
90 QLabel *m_lbRepeat {nullptr};
91 QCheckBox *m_ckDither {nullptr};
92 QCheckBox *m_ckReverse {nullptr};
93 KComboBox *m_cmbShape {nullptr};
94 KComboBox *m_cmbRepeat {nullptr};
95 QLabel *m_lbAntiAliasThreshold {nullptr};
97 KConfigGroup m_configGroup;
98};
99
101{
102
103public:
105 : KisToolPaintFactoryBase("KritaFill/KisToolGradient") {
106 setToolTip(i18n("Gradient Tool"));
108 setIconName(koIconNameCStr("krita_tool_gradient"));
109 setShortcut(QKeySequence(Qt::Key_G));
110 setPriority(1);
112 }
113
115
117 return new KisToolGradient(canvas);
118 }
119
120};
121
122#endif //KIS_TOOL_GRADIENT_H_
123
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
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
void activate(const QSet< KoShape * > &shapes) override
KConfigGroup m_configGroup
KisGradientPainter::enumGradientShape m_shape
void beginPrimaryAction(KoPointerEvent *event) override
void paintLine(QPainter &gc)
KisDoubleSliderSpinBox * m_slAntiAliasThreshold
~KisToolGradient() override
QCheckBox * m_ckDither
QCheckBox * m_ckReverse
void slotSetAntiAliasThreshold(qreal)
KComboBox * m_cmbShape
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.
virtual void setDirty()
Definition kis_node.cpp:577
KisNodeSP currentNode() const
Definition kis_tool.cc:370
KisCanvas2 * canvas